Show Answers Posted to a Question

You can use this request to search for and return a paged list of answers posted to a specific question.

/services/v2/question/[questionId]/answer.json

You can use the following parameters in your show answers posted to a question 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 answers in the question page permission under Anonymous Roles in the Advanced Editor.

  • With the includeOnly parameter set to id and name (/services/v2/question/[questionID]/answer.json?includeOnly=id,name) to the AnswerHub REST API.

  • We added this request in version 1.6.3.

Sample Request

A GET show answers posted to a question request for a question (questionId: 473) 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/473/answer.json"

📘

Note about the Response:

This Specific question only had one answer. If the question has more than one answer, then all the answers will show up. If the number of answers exceeds the amount that can fit in a single page, then the system will add those onto the second page. To view different pages add the page=n parameter to your request.

Sample Response

Successful Response:

  • HTTP Status 200 - OK
{
    "name": "",
    "sort": "votes",
    "page": 1,
    "pageSize": 10,
    "pageCount": 1,
    "listCount": 2,
    "totalCount": 2,
    "sorts": [
        "active",
        "newest",
        "hottest",
        "votes",
        "viewCount",
        "usedCount",
        "answerCount",
        "answerCountAsc",
        "commentCount",
        "favoriteCount",
        "followers",
        "reportCount"
    ],
    "list": [
        {
            "id": 474,
            "type": "answer",
            "creationDate": 1545231773000,
            "creationDateFormatted": "12/19/2018 03:02 PM",
            "title": "Yes, and it’s because heat in electr ...",
            "body": "<div class=\"fr-view clearfix\">Yes, and it’s because heat in electrical components causes electrons inside to move around unpredictably. This behaviour can be captured electronically and digitised as a sequence of truly random numbers.</div>",
            "bodyAsHTML": "<div class=\"fr-view clearfix\">\n Yes, and it’s because heat in electrical components causes electrons inside to move around unpredictably. This behaviour can be captured electronically and digitised as a sequence of truly random numbers.\n</div>",
            "author": {
                "id": 21,
                "username": "einstein",
                "realname": "Albert Einstein",
                "reputation": 47
            },
            "lastEditedAction": 495,
            "activeRevisionId": 474,
            "revisionIds": [
                474
            ],
            "lastActiveUserId": 21,
            "lastActiveDate": 1545231773000,
            "originalParentId": 473,
            "attachments": [],
            "childrenIds": [],
            "commentIds": [],
            "marked": false,
            "topics": [],
            "containerIds": [],
            "wiki": false,
            "score": 1,
            "depth": 0,
            "viewCount": 0,
            "upVoteCount": 1,
            "downVoteCount": 0,
            "nodeStates": []
        },
        {
            "id": 799,
            "type": "answer",
            "creationDate": 1547654325000,
            "creationDateFormatted": "01/16/2019 03:58 PM",
            "title": "awesome answer!",
            "body": "<div class=\"fr-view clearfix\"><p>awesome answer!</p></div>",
            "bodyAsHTML": "<div class=\"fr-view clearfix\">\n <p>awesome answer!</p>\n</div>",
            "author": {
                "id": 11,
                "username": "answerhub",
                "reputation": 2
            },
            "lastEditedAction": 914,
            "activeRevisionId": 799,
            "revisionIds": [
                799
            ],
            "lastActiveUserId": 11,
            "lastActiveDate": 1547654325000,
            "originalParentId": 473,
            "attachments": [],
            "childrenIds": [],
            "commentIds": [],
            "marked": false,
            "topics": [],
            "containerIds": [],
            "wiki": false,
            "score": 0,
            "depth": 0,
            "viewCount": 0,
            "upVoteCount": 0,
            "downVoteCount": 0,
            "nodeStates": []
        }
    ]
}
Language
Credentials
Basic
base64
:
Click Try It! to start a request and see the response here!