(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:

NameDescriptionTypeRequiredExample values
idThe numerical ID of the desired questionIntegeryes123
texttext of the questionStringyes 
typeShould 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 listIntegeryes1,2,3
surveyIdThe numerical ID of surveyIntegeryes 
enabledBy default, it is set to trueBooleannotrue, false
questionOptionsRequired if type is equal to 1, 2 or 8JSON list-"{'text' : 'option1' },{'text' : 'option2'}" , "{'text' : 'Go' , 'branch' : '1'},{'text':'STOP'}"
isMandatoryIndicate if the answer to the question is required or not, set to true by defaultBooleannotrue, false
isPhotoMandatoryIndicate if the answer to the question needed to be with photo or not, set to false by defaultBooleannotrue, false
linesRepresent the question lines for the question of type tableJSON listyes if type = 7"{'value' : '4'},{'value' : '6'}"
columnsRepresent the question columns for the question of type tableJSON listyes if type = 7"{'text' : 'How is the quality', 'type' : '1' , options : [{text : good},{text : bad}}]"
linesTypeIndicate the type of question lines . Should be equal to 1 if item, 2 if item category, 3 if item group, 4 if textIntegeryes if type = 71,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."
}