Create a Survey



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.

-u answerhub:test123 
-H "Accept: application/json" 
-H "Content-type: application/json" 
-d '{ “title”:<string required>, “deadline”:<date ISO format>, “elements”: [ {‘content”:<string required>} ]}' "" -v

Successful Response

HTTPS Status: 201

   “id”:<long id>,

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.”}
Click Try It! to start a request and see the response here!