Report

Simple Data Toolkit - Tutorial - Ortingo API - Python

November 08, 2023 at 10:30 PM PST
This post has no media.
Profile picture
Franklin Powers

At the time of this writing, Ortingo does not have an official API. Fortunately, Simple Data Toolkit provides an unofficial API for reading posts (at the time of this writing, the release of this is pending for complete support, but it is coming soon)

To retrieve all posts for a given user in Python, using Simple Data Toolkit, we can do the following:


from sdtk import com_sdtk_api_OrtingoAPI


def printer(data, reader):
print(reader.toArrayOfNativeMaps(None))

com_sdtk_api_OrtingoAPI.postsAPI().retrieveData({"owner": "60CQ59FN46SVQFXJ"}, printer)



Let's suppose we want only a list of titles for a given user, we can do this instead:


from sdtk import com_sdtk_api_OrtingoAPI


def printer(data, reader):
print(reader.filterColumnsOnly(["title"]).toArrayOfNativeMaps(None))

com_sdtk_api_OrtingoAPI.postsAPI().retrieveData({"owner": "60CQ59FN46SVQFXJ"}, printer)


We can also pull suggested content from Ortingo with the following, where the topics we are searching on are provided with the query parameter (in this case it's value is data):

from sdtk import com_sdtk_api_OrtingoAPI

def printerUrls(data, reader):
print(reader.filterColumnsOnly(["url"]).toArrayOfNativeMaps(None))

com_sdtk_api_OrtingoAPI.suggestionsAPI().retrieveData({"query": "data"}, printerUrls)


And finally, we can also pull comments attached to a post in Ortingo with the following, where the user is myself and the post is a test post I created:

from sdtk import com_sdtk_api_OrtingoAPI

def printerComments(data, reader):
print(reader.filterColumnsOnly(["commentDate", "post"]).toArrayOfNativeMaps(None))

com_sdtk_api_OrtingoAPI.commentsAPI().retrieveData({"owner": "60CQ59FN46SVQFXJ", "id": "test"}, printerComments)


The columns supported at the time of this writing are:
- id
- owner
- title
- subtitle
- post
- url

For comments the following columns are supported:
- id
- owner
- commentDate
- replyTo
- post

Any thoughts on Franklin's post?

To comment or reply, you need an Ortingo account.

Sign in or sign up

Here's what Ortingoers think of Franklin's post.

There are no comments on this post.