Retrieve Topic List

You can use this API request to retrieve a paged list of the topics created on your AnswerHub site.

/services/v2/topic.json

You can use the following parameters in your retrieve topic list request:

Paging and Sorting: page, pageSize, sort
Search: q, type, lang
projection: include, exclude, includeOnly
Other options: wrap, v1

🚧

Permissions & Notes:

  • You must have the View users list permission under Anonymous Roles in the Advanced Editor.

  • You can use the sort request parameter to specify which of the sorting and ordering criteria you want to use.

    • An invalid sorting name will cause the request to reset to the default criteria.
  • With the includeOnly parameter set to id and name (/services/v2/topic.json?includeOnly=id,name) to the AnswerHub REST API.

  • We added this request in version 1.6.3.

Sample Request

A GET retrieve topic list request sent to https://apidocs.cloud.answerhub.com using a human-readable Username/Password (answerhub/test123) would look like this:

curl 
-u answerhub:test123 
-H "Accept: application/json" 
-H "Content-type: application/json" 
-X GET "https://apidocs.cloud.answerhub.com/services/v2/topic.json"

👍

Use of pageSize:

Note, we used the parameter pageSize=1 to decrease the size of the response. Without this parameter, the response will display a page long list of topics. Moving to a different page in the response requires you to resend the response with the parameter page=n at the end with n being the desired page number.

Sample Response

{
    "name": "",
    "sort": "popularity",
    "page": 1,
    "pageSize": 60,
    "pageCount": 2,
    "listCount": 60,
    "totalCount": 116,
    "list": [
        {
            "id": 7,
            "creationDate": 1545231736000,
            "creationDateFormatted": "12/19/2018 03:02 PM",
            "name": "people",
            "author": {
                "id": 22,
                "username": "confused",
                "realname": "Confused User",
                "reputation": 0
            },
            "usedCount": 108,
            "getImmediateChildren": [],
            "getParents": []
        },
        {
            "id": 12,
            "creationDate": 1545231736000,
            "creationDateFormatted": "12/19/2018 03:02 PM",
            "name": "health",
            "author": {
                "id": 22,
                "username": "confused",
                "realname": "Confused User",
                "reputation": 0
            },
            "usedCount": 58,
            "getImmediateChildren": [],
            "getParents": []
        },
        {
            "id": 593,
            "creationDate": 1547066745000,
            "creationDateFormatted": "01/09/2019 08:45 PM",
            "name": "devops",
            "author": {
                "id": 53,
                "username": "RonGidron",
                "reputation": 0
            },
            "usedCount": 47,
            "getImmediateChildren": [],
            "getParents": []
        },
        {
            "id": 29,
            "creationDate": 1545231737000,
            "creationDateFormatted": "12/19/2018 03:02 PM",
            "name": "biology",
            "author": {
                "id": 22,
                "username": "confused",
                "realname": "Confused User",
                "reputation": 0
            },
            "usedCount": 44,
            "getImmediateChildren": [],
            "getParents": []
        },
        {
            "id": 86,
            "creationDate": 1545231741000,
            "creationDateFormatted": "12/19/2018 03:02 PM",
            "name": "bodies",
            "author": {
                "id": 22,
                "username": "confused",
                "realname": "Confused User",
                "reputation": 0
            },
            "usedCount": 42,
            "getImmediateChildren": [],
            "getParents": []
        },
        {
            "id": 1,
            "creationDate": 1545231736000,
            "creationDateFormatted": "12/19/2018 03:02 PM",
            "name": "science",
            "author": {
                "id": 22,
                "username": "confused",
                "realname": "Confused User",
                "reputation": 0
            },
            "usedCount": 36,
            "getImmediateChildren": [],
            "getParents": []
        },
        {
            "id": 28,
            "creationDate": 1545231737000,
            "creationDateFormatted": "12/19/2018 03:02 PM",
            "name": "animals",
            "author": {
                "id": 22,
                "username": "confused",
                "realname": "Confused User",
                "reputation": 0
            },
            "usedCount": 35,
            "getImmediateChildren": [],
            "getParents": []
        },
        {
            "id": 18,
            "creationDate": 1545231736000,
            "creationDateFormatted": "12/19/2018 03:02 PM",
            "name": "environment",
            "author": {
                "id": 22,
                "username": "confused",
                "realname": "Confused User",
                "reputation": 0
            },
            "usedCount": 29,
            "getImmediateChildren": [],
            "getParents": []
        },
        {
            "id": 631,
            "creationDate": 1547066765000,
            "creationDateFormatted": "01/09/2019 08:46 PM",
            "name": "agile",
            "author": {
                "id": 40,
                "username": "Scott_Edwards",
                "reputation": 0
            },
            "usedCount": 26,
            "getImmediateChildren": [],
            "getParents": []
        },
      ...deleted several lines of code because too long...
        }
    ]
}
Language
Authentication
Basic
base64
:
Click Try It! to start a request and see the response here!