post https://apidocs.cloud.answerhub.com/services/v2/node//survey.json
/services/v2/node/{node}/survey.json
Permissions & Notes:
There is no permission required to make this API request.
Sample Request
The example below depicts the creation of a survey on the question node with an ID of 123.
curl
-u answerhub:test123
-H "Accept: application/json"
-H "Content-type: application/json"
-X POST
-d '{ ātitleā:<string required>, ādeadlineā:<date ISO format>, āelementsā: [ {ācontentā:<string required>} ]}' "https://apidocs.cloud.answerhub.com/services/v2/node/123/survey.json" -v
Successful Response
HTTPS Status: 201
{
āidā:<long id>,
ācreationDateā:<>,
āmodificationDateā:<>,
ātitleā:"<string>",
ādeadlineā:<date>,
āsurveyElementā:[
{
ācontentā:"<string>",
āidā:<long>
}
]
}
Expected Error Responses
There are 5 different errors you might see. They are all shown below in separate tabs.
Each one gives an HTTP Status 400.
400: {āerrorā:āNode already has a surveyā}
400: {āerrorā:āDeadline date not set.ā}
400: {āerrorā:āDeadline date cannot be in the past.ā}
400: {āerrorā:āSurvey title cannot be empty.ā}
400: {āerrorā:āThere should be at least 2 Survey elements and no more than 5.ā}