You can use this API request to retrieve a list of questions related to a specific topic.
/services/v2/question.json?topics=[data]
The following parameters can be used in your retrieve questions related to a topic request:
Specific: topics, unanswered
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 the questions list permission under Anonymous Roles in the Advanced Editor.
With the includeOnly parameter set to id and name (/services/v2/topic.json?includeOnly=id,name) to the AnswerHub REST API.
This request was added in version 1.6.3.
Sample Request
A GET retrieve questions related to a topic request for questions related a topic (topicId: "technology") 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/question.json?topics=technology"
What this API Call looks like
www.this-is-the-url.com/services/v2/question.json?topics=This_is_a_very_unique_topic_for_api_docs
Sample Response
Successful Response:
- HTTP Status 200 - OK
{
"name": "",
"sort": "active",
"page": 1,
"pageSize": 15,
"pageCount": 1,
"listCount": 4,
"totalCount": 4,
"sorts": [
"active",
"newest",
"hottest",
"votes",
"viewCount",
"usedCount",
"answerCount",
"answerCountAsc",
"commentCount",
"favoriteCount",
"followers",
"reportCount"
],
"list": [
{
"id": 806,
"type": "question",
"creationDate": 1547654401000,
"creationDateFormatted": "01/16/2019 04:00 PM",
"title": "Where do I go to learn more about AnswerHub as a Developer?",
"body": "<div class=\"fr-view clearfix\"><p>I would like to know if there is a site I can go to if I am interested in learning about AnswerHub as a developer. </p></div>",
"bodyAsHTML": "<div class=\"fr-view clearfix\">\n <p>I would like to know if there is a site I can go to if I am interested in learning about AnswerHub as a developer. </p>\n</div>",
"author": {
"id": 11,
"username": "answerhub",
"reputation": 2
},
"lastEditedAction": 926,
"activeRevisionId": 806,
"revisionIds": [
806
],
"lastActiveUserId": 108,
"lastActiveDate": 1549319524000,
"attachments": [],
"childrenIds": [
800,
820,
827
],
"commentIds": [
820,
827
],
"marked": true,
"topics": [
{
"id": 543,
"creationDate": 1547066694000,
"creationDateFormatted": "01/09/2019 08:44 PM",
"name": "answerhub",
"author": {
"id": 73,
"username": "jessed",
"reputation": 0
},
"usedCount": 4,
"getImmediateChildren": [],
"getParents": []
},
{
"id": 805,
"creationDate": 1547654401000,
"creationDateFormatted": "01/16/2019 04:00 PM",
"name": "developer",
"author": {
"id": 11,
"username": "answerhub",
"reputation": 2
},
"usedCount": 1,
"getImmediateChildren": [],
"getParents": []
},
{
"id": 127,
"creationDate": 1545231744000,
"creationDateFormatted": "12/19/2018 03:02 PM",
"name": "technology",
"author": {
"id": 22,
"username": "confused",
"realname": "Confused User",
"reputation": 0
},
"usedCount": 5,
"getImmediateChildren": [],
"getParents": []
}
],
"primaryContainerId": 8,
"containerIds": [
7,
8
],
"slug": "where-do-i-go-to-learn-more-about-answerhub-as-a-d",
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 10,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": [],
"answers": [
800
],
"answerCount": 1
},
{
"id": 473,
"type": "question",
"creationDate": 1545231773000,
"creationDateFormatted": "12/19/2018 03:02 PM",
"title": "Can computers generate truly random numbers?",
"body": "",
"bodyAsHTML": "",
"author": {
"id": 22,
"username": "confused",
"realname": "Confused User",
"reputation": 0
},
"lastEditedAction": 494,
"activeRevisionId": 473,
"revisionIds": [
473
],
"lastActiveUserId": 7,
"lastActiveDate": 1548273367000,
"attachments": [],
"childrenIds": [
474,
799
],
"commentIds": [],
"marked": false,
"topics": [
{
"id": 127,
"creationDate": 1545231744000,
"creationDateFormatted": "12/19/2018 03:02 PM",
"name": "technology",
"author": {
"id": 22,
"username": "confused",
"realname": "Confused User",
"reputation": 0
},
"usedCount": 5,
"getImmediateChildren": [],
"getParents": []
},
{
"id": 263,
"creationDate": 1545231754000,
"creationDateFormatted": "12/19/2018 03:02 PM",
"name": "math",
"author": {
"id": 22,
"username": "confused",
"realname": "Confused User",
"reputation": 0
},
"usedCount": 4,
"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": []
}
],
"primaryContainerId": 8,
"containerIds": [
7,
8
],
"slug": "can-computers-generate-truly-random-numbers-1",
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 6,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": [],
"answers": [
799,
474
],
"answerCount": 2
},
{
"id": 266,
"type": "question",
"creationDate": 1545231754000,
"creationDateFormatted": "12/19/2018 03:02 PM",
"title": "Can computers generate truly random numbers?",
"body": "",
"bodyAsHTML": "",
"author": {
"id": 22,
"username": "confused",
"realname": "Confused User",
"reputation": 0
},
"lastEditedAction": 301,
"activeRevisionId": 266,
"revisionIds": [
266
],
"lastActiveUserId": 22,
"lastActiveDate": 1545231754000,
"attachments": [],
"childrenIds": [
267
],
"commentIds": [],
"marked": false,
"topics": [
{
"id": 127,
"creationDate": 1545231744000,
"creationDateFormatted": "12/19/2018 03:02 PM",
"name": "technology",
"author": {
"id": 22,
"username": "confused",
"realname": "Confused User",
"reputation": 0
},
"usedCount": 5,
"getImmediateChildren": [],
"getParents": []
},
{
"id": 263,
"creationDate": 1545231754000,
"creationDateFormatted": "12/19/2018 03:02 PM",
"name": "math",
"author": {
"id": 22,
"username": "confused",
"realname": "Confused User",
"reputation": 0
},
"usedCount": 4,
"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": []
}
],
"primaryContainerId": 8,
"containerIds": [
7,
8
],
"slug": "can-computers-generate-truly-random-numbers",
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 1,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": [],
"answers": [
267
],
"answerCount": 1
},
{
"id": 128,
"type": "question",
"creationDate": 1545231744000,
"creationDateFormatted": "12/19/2018 03:02 PM",
"title": "Can the government track you if you have a GPS-enabled mobile phone?",
"body": "",
"bodyAsHTML": "",
"author": {
"id": 22,
"username": "confused",
"realname": "Confused User",
"reputation": 0
},
"lastEditedAction": 153,
"activeRevisionId": 128,
"revisionIds": [
128
],
"lastActiveUserId": 22,
"lastActiveDate": 1545231744000,
"attachments": [],
"childrenIds": [
129
],
"commentIds": [],
"marked": false,
"topics": [
{
"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": 126,
"creationDate": 1545231744000,
"creationDateFormatted": "12/19/2018 03:02 PM",
"name": "gps",
"author": {
"id": 22,
"username": "confused",
"realname": "Confused User",
"reputation": 0
},
"usedCount": 1,
"getImmediateChildren": [],
"getParents": []
},
{
"id": 127,
"creationDate": 1545231744000,
"creationDateFormatted": "12/19/2018 03:02 PM",
"name": "technology",
"author": {
"id": 22,
"username": "confused",
"realname": "Confused User",
"reputation": 0
},
"usedCount": 5,
"getImmediateChildren": [],
"getParents": []
}
],
"primaryContainerId": 8,
"containerIds": [
7,
8
],
"slug": "can-the-government-track-you-if-you-have-a-gps-ena",
"wiki": false,
"score": 0,
"depth": 0,
"viewCount": 1,
"upVoteCount": 0,
"downVoteCount": 0,
"nodeStates": [],
"answers": [
129
],
"answerCount": 1
}
]
}