Retrieve Questions List

You can use this API request to retrieve a list of the questions that have been posted to your AnswerHub site.

/services/v2/question.json

The following parameters can be used in your retrieve questions list request:

specific: topics, unanswered, spaceId
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/question.json?includeOnly=id,name) to the AnswerHub REST API.

  • This request was added in version 1.6.3.

Sample Requests

A GET retrieve question 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/question.json"

You can also search for questions that only appear in a specific space on your AnswerHub site. In order to do so, you must add the spaceId to your request as a query parameter. For example, the GET retrieve question list request above limited to a space (spaceId: 11) 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?spaceId=11&pageSize=2"

👍

Use of pageSize

Note that the parameter pageSize=1 was used to decrease the length of the JSON Response. Without this parameter the response will display a specified number of questions. You can change the number of questions that are displayed on each page by using the parameter pageSize=n where n is the number of questions per page. You can navigate different pages by using the parameter page=n where n is an integer that is less than or equal to the total number of pages available.

Sample Response

Successful Response to the request including the queries spaceId=11 and pageSize=2:

  • HTTP Status - 200 - OK
{
    "name": "",
    "sort": "active",
    "page": 1,
    "pageSize": 2,
    "pageCount": 3,
    "listCount": 2,
    "totalCount": 5,
    "sorts": [
        "active",
        "newest",
        "hottest",
        "votes",
        "viewCount",
        "usedCount",
        "answerCount",
        "answerCountAsc",
        "commentCount",
        "favoriteCount",
        "followers",
        "reportCount"
    ],
    "list": [
        {
            "id": 841,
            "type": "question",
            "creationDate": 1549490560000,
            "creationDateFormatted": "02/06/2019 10:02 PM",
            "title": "Am I doing this correctly? (Mod Test)",
            "body": "<div class=\"fr-view clearfix\"><p>TESTING SEND NODE TO MODERATION VIA API</p></div>",
            "bodyAsHTML": "<div class=\"fr-view clearfix\">\n <p>TESTING SEND NODE TO MODERATION VIA API</p>\n</div>",
            "author": {
                "id": 31,
                "username": "demo",
                "reputation": 0
            },
            "lastEditedAction": 1084,
            "activeRevisionId": 843,
            "revisionIds": [
                843
            ],
            "lastActiveUserId": 31,
            "lastActiveDate": 1549490560000,
            "attachments": [],
            "childrenIds": [],
            "commentIds": [],
            "marked": false,
            "topics": [
                {
                    "id": 829,
                    "creationDate": 1549486662000,
                    "creationDateFormatted": "02/06/2019 08:57 PM",
                    "name": "node",
                    "author": {
                        "id": 31,
                        "username": "demo",
                        "reputation": 0
                    },
                    "usedCount": 1,
                    "getImmediateChildren": [],
                    "getParents": []
                },
                {
                    "id": 830,
                    "creationDate": 1549486662000,
                    "creationDateFormatted": "02/06/2019 08:57 PM",
                    "name": "moderation",
                    "author": {
                        "id": 31,
                        "username": "demo",
                        "reputation": 0
                    },
                    "usedCount": 1,
                    "getImmediateChildren": [],
                    "getParents": []
                },
                {
                    "id": 691,
                    "creationDate": 1547066803000,
                    "creationDateFormatted": "01/09/2019 08:46 PM",
                    "name": "api",
                    "author": {
                        "id": 52,
                        "username": "billoakes",
                        "reputation": 0
                    },
                    "usedCount": 7,
                    "getImmediateChildren": [],
                    "getParents": []
                }
            ],
            "primaryContainerId": 11,
            "containerIds": [
                7,
                11
            ],
            "slug": "am-i-doing-this-correctly-mod-test",
            "wiki": false,
            "score": 0,
            "depth": 0,
            "viewCount": 1,
            "upVoteCount": 0,
            "downVoteCount": 0,
            "nodeStates": [],
            "answers": [],
            "answerCount": 0
        },
        {
            "id": 832,
            "type": "question",
            "creationDate": 1549482216000,
            "creationDateFormatted": "02/06/2019 07:43 PM",
            "title": "I don't know what I am doing. Can someone help?",
            "body": "<div class=\"fr-view clearfix\"><p>TESTING DELETE NODE API</p></div>",
            "bodyAsHTML": "<div class=\"fr-view clearfix\">\n <p>TESTING DELETE NODE API</p>\n</div>",
            "author": {
                "id": 31,
                "username": "demo",
                "reputation": 0
            },
            "lastEditedAction": 1072,
            "activeRevisionId": 828,
            "revisionIds": [
                828
            ],
            "lastActiveUserId": 31,
            "lastActiveDate": 1549482216000,
            "attachments": [],
            "childrenIds": [],
            "commentIds": [],
            "marked": false,
            "topics": [
                {
                    "id": 630,
                    "creationDate": 1547066772000,
                    "creationDateFormatted": "01/09/2019 08:46 PM",
                    "name": "testing",
                    "author": {
                        "id": 43,
                        "username": "Tom.Pryce",
                        "reputation": 0
                    },
                    "usedCount": 6,
                    "getImmediateChildren": [],
                    "getParents": []
                },
                {
                    "id": 831,
                    "creationDate": 1549482216000,
                    "creationDateFormatted": "02/06/2019 07:43 PM",
                    "name": "delete",
                    "author": {
                        "id": 31,
                        "username": "demo",
                        "reputation": 0
                    },
                    "usedCount": 1,
                    "getImmediateChildren": [],
                    "getParents": []
                }
            ],
            "primaryContainerId": 11,
            "containerIds": [
                7,
                11
            ],
            "slug": "i-dont-know-what-i-am-doing-can-someone-help",
            "wiki": false,
            "score": 0,
            "depth": 0,
            "viewCount": 2,
            "upVoteCount": 0,
            "downVoteCount": 0,
            "nodeStates": [
                "closed"
            ],
            "answers": [],
            "answerCount": 0
        }
    ]
}
Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!