Post an Answer

You can use this request to post an answer to a question on your AnswerHub site.

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

You can use the following parameters in your post an answer request:

Body: you can use any field of the body parameter.
Other options: wrap.

🚧

Permissions & Notes:

  • You must have the Answer questions permission under Standard Roles in the Advanced Editor.

  • You must have the Publish answer permission under Standard Roles in the Advanced Editor to automatically have your answer published. Otherwise, it will get placed in the moderation queue.

  • The location response header will contain the URL for the newly created comment.

  • You can specify the data describing the answer you are posting, both in the body of the request, or as a request parameter, with the same names as the fields in the body.

    • When you send data in the body of the request, the format should match the URL extension or the value of the site's HTTP request header content-type.
    • If you specify data values for the same field, both on the request body and as a request or query parameters, the value of the parameters takes precedence over the value in the body.
  • We added this request in version 1.6.3.

Sample Request

A POST post an answer request to post an answer ("AnswerHub is a developer engagement and community platform. By combining our core set of features and plugin options, you can create a custom, world-class developer ecosystem.") to a question (questionId: 823) sent to https://apidocs.cloud.answerhub.com using a human-readable username and password (answerhub/test123), would look like this:

curl 
-u "answerhub:test123" 
-H "Accept: application/json" 
-H "Content-type: application/json" 
-X POST 
-d '{"body":"AnswerHub is a developer engagement and community platform. By combining our core set of features and plugin options, you can create a custom, world-class developer ecosystem."}' "https://apidocs.cloud.answerhub.com/services/v2/question/823/answer.json" -v

Expected Response

Successful Response:

  • HTTP Status 201 - Created
{
    "id": "833",
    "type": "answer",
    "creationDate": 1549641370134,
    "creationDateFormatted": "02/08/2019 03:56 PM",
    "body": "<div class=\"fr-view clearfix\">AnswerHub is a developer engagement and community platform. By combining our core set of features and plugin options, you can create a custom, world-class developer ecosystem.</div>",
    "bodyAsHTML": "<div class=\"fr-view clearfix\">AnswerHub is a developer engagement and community platform. By combining our core set of features and plugin options, you can create a custom, world-class developer ecosystem.</div>",
    "author": {
        "id": 108,
        "username": "admin",
        "realname": null,
        "avatar": "https://secure.gravatar.com/avatar/4e955c70eeff0abe1974c9be300a8887?d=identicon&r=PG",
        "reputation": 91
    },
    "lastEditedAction": 1105,
    "activeRevisionId": 829,
    "revisionIds": [
        829
    ],
    "lastActiveUserId": 108,
    "lastActiveDate": 1549641370134,
    "parentId": 823,
    "parentAuthor": {
        "username": "suspendabletestuser",
        "realname": null
    },
    "originalParentId": 823,
    "childrenIds": [],
    "commentIds": [],
    "marked": false,
    "topics": [],
    "containerIds": [],
    "plug": null,
    "wiki": false,
    "score": 0,
    "depth": 0,
    "reportCount": 0
}
Language
Authorization
Basic
base64
:
Click Try It! to start a request and see the response here!