Get a list of topics

Your application retrieves a list of topics by using the getTopicContexts task, which returns a list of topic contexts with the name and identifier of each topic.

This task can be used to populate a drop-down or selection list of existing topics in the Save to Topic dialog box. The result is alphabetically sorted by name and includes the number of values returned and the total number of values. Optionally, you can set a start row and a chunk size in the TopicsServiceContext value object.

This task returns all topics available to this user. To also search for a particular topic by ID, set the findTopicId parameter to an ID that is greater than or equal to 0.

To limit the results by name, set the TopicsServiceContext.nameContainsFilter field to a string. In this case, the task returns only TopicContexts with topic names that contain that string with a case-insensitive search. For example, when you set the nameContainsFilter field to imp, the resulting topic contexts might have results Important Results and Topics imported.

TopicContexts extends the value object TopicsServiceContext and has the actual number of rows returned in numRows field and the total number of rows in the totalRows field.

If the findTopicId parameter was set, then the matchingTopicContext field in TopicsContexts contains the matching context or null if it was not found or not set. You can use this field to implement an auto complete field for the existing topic name in the Save to Topic dialog box in your application.

TopicsContexts JSON

The getTopicContexts task returns TopicContexts, which contains a list of topic IDs and names.


{
    "topicsServiceContext": {
       TopicServiceContext object
    },
    “matchingTopicContext” : {
            "id": “number”,
            "name": "string"
     },
    "topicContexts": [
        {
            "id": “number”,
            "name": "string"
        }
    ]
}