(Quick Reference)
Service: Update a question Description: Returns the updated question in JSON format when successful. URL: https://BASE_URL/api/VERSION/questions/{id} Method: PUT Request content type: application/json Parameters: Name | Description | Type | Required | Example values |
---|
id | The numerical ID of the desired question | Integer | yes | 123 | text | text of the question | String | yes | | type | Should be equal to 1 if multiple choice , 2 if unique choice , 3 if text , 4 if date , 5 if number , 6 if likert scale , 7 if table and 8 if drop down list | Integer | yes | 1,2,3 | surveyId | The numerical ID of survey | Integer | yes | | enabled | By default, it is set to true | Boolean | no | true, false | questionOptions | Required if type is equal to 1, 2 or 8 | JSON list | - | "{'text' : 'option1' },{'text' : 'option2'}" , "{'text' : 'Go' , 'branch' : '1'},{'text':'STOP'}" | isMandatory | Indicate if the answer to the question is required or not, set to true by default | Boolean | no | true, false | isPhotoMandatory | Indicate if the answer to the question needed to be with photo or not, set to false by default | Boolean | no | true, false | lines | Represent the question lines for the question of type table | JSON list | yes if type = 7 | "{'value' : '4'},{'value' : '6'}" | columns | Represent the question columns for the question of type table | JSON list | yes if type = 7 | "{'text' : 'How is the quality', 'type' : '1' , options : [{text : good},{text : bad}}]" | linesType | Indicate the type of question lines . Should be equal to 1 if item , 2 if item category , 3 if item group , 4 if text | Integer | yes if type = 7 | 1,2,3,4 |
Success Output Success case: response.status = 200 {
"id": 35,
"survey": {
"id": 10,
"name": "Quality of products",
"href": "/api/v1.0/surveys/10"
},
"text": "Table Question",
"type": "7",
"isMandatory": true,
"isPhotoMandatory": false,
"enabled": true,
"questionOptions": [
{
"id": 59,
"text": "Good",
"href": "/api/v1.0/questionOptions/59"
},
{
"id": 60,
"text": "Acceptable",
"href": "/api/v1.0/questionOptions/60"
},
{
"id": 61,
"text": "Bad",
"href": "/api/v1.0/questionOptions/61"
}
],
"answers": [],
"questionLines": [
{
"id": 1,
"text": "Product Baby2",
"href": "/api/v1.0/questionLines/1"
}
],
"questionColumns": [
{
"id": 1,
"name": "How do you find our product ?",
"href": "/api/v1.0/questionColumns/1"
}
],
"dynamicLines": false,
"addFilterByCategory": false,
"organization": "entity1",
"dateCreated": "2016-11-25T09:11:47Z",
"lastUpdated": "2016-11-25T09:11:47Z"
}
Failure Output Failure case: response.status = 400
{
"error": "invalid_param_type",
"error_description": "The type of parameter surveyId you provided is not valid for this request."
}
{
"error": "invalid_param_type",
"error_description": "An invalid value was specified for parameter: isPhotoMandatory (must be Boolean)"
}
{
"error": "missing_param",
"error_description": "questionOptions parameter is missing"
}
{
"error": "update_not_authorized",
"error_description": "Question with answers could not be updated"
}
{
"error": "update_not_authorized",
"error_description": "Survey with id 4 has already answers"
} Failure case: response.status = 404 {
"error": "not_found",
"error_description": "The survey with the id 44 doesn't exist."
}
|
|