POST: https://{env}-api.xebo.ai/v3/survey-management/surveys/{survey_id}/blocks/{block_id}/questions
The value of environment {{env}} variable depends upon your datacenter. Refer to the Environment page for more details.
"Content-Type": "application/json"
Authorization: type: Bearer type token: <access token> granted from login API Or x-api-key: <api key copied from the platform> Content-Type: application/json
Request Body
{
"title": "First question",
"quesType": "single_choice",
"quesFamily": "choice",
"options": {
"row": [
{
"weight": 0,
"text": "1"
},
{
"weight": 0,
"text": "2"
}
]
}
}
Request Sample
curl --location 'https://az4-api.xebo.ai/v3/survey-management/surveys/951381d4-e7d1-4e5a-85f1-be379b18045a/blocks/5da2381b-4cd4-4195-beee-5c4f1369c2c1/questions' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVC") --data '{ "title": "First question", "quesType": "single_choice", "quesFamily": "choice", "options": { "row": [ { "weight": 0, "text": "1" }, { "weight": 0, "text": "2" } ] } } '
var data = JSON.stringify({
"title": "First question",
"quesType": "single_choice",
"quesFamily": "choice",
"options": {
"row": [
{
"weight": 0,
"text": "1"
},
{
"weight": 0,
"text": "2"
}
]
}
});
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function() {
if(this.readyState === 4) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://az4-api.xebo.ai/v3/survey-management/surveys/951381d4-e7d1-4e5a-85f1-be379b18045a/blocks/5da2381b-4cd4-4195-beee-5c4f1369c2c1/questions");
xhr.setRequestHeader("Content-Type", "application/json");
xhr.setRequestHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e");
xhr.send(data);
Responses
{
"data": {
"_id": "641ad1b6bf72bd8e4545d6f1",
"org": "74b7d757-c9e5-4c24-9505-abd3c19bf416",
"title": "First question",
"description": {
"enabled": false,
"text": ""
},
"quesType": "single_choice",
"fromCarryFrwd": {
"row": {
"data": []
},
"col": {
"data": []
}
},
"options": {
"row": [
{
"text": "Ques1 options",
"addTextVald": {
"label": "",
"subType": "",
"max": "",
"min": "",
"errMsg": "",
"required": false
},
"_id": "641ad1b6bf72bd8e4545d6f2"
}
],
"col": []
},
"isListed": true,
"createdBy": "c6d6e367-9899-4377-91b8-74d8f08e1a86",
"updatedBy": "c6d6e367-9899-4377-91b8-74d8f08e1a86",
"uuid": "61d70223-8036-4bb0-840a-8c3d9963e5a3",
"logics": [],
"priortyList": [],
"metaData": [],
"createdAt": "2022-11-23T10:45:37.808Z",
"updatedAt": "2022-11-23T10:45:37.808Z",
"__v": 0
}
}
{
"success": false,
"code": 401,
"status": "Unauthorized",
"error": "AUTHENTICATION_ERROR",
"message": "The authorization token was not provided"
}
{
"success": false,
"code": 500,
"status": "Internal Server Error",
"error": "SERVER_ERROR",
"message": "Error in processing your request"
}
Note: Please do not share your tokens in publicly accessible areas or to anyone. Also, this token generated is valid for 24 hours only. After its expiry, you can regenerate the access token from the same API endpoint by passing the username and password or from the refresh token API with the help of refresh token.