(Quick Reference)
66 Questions - Reference Documentation
Version: 2.1
66 Questions
66.1 List
Service: List of questions Description: This web service returns a JSON list of questions. URL: https://BASE_URL/api/VERSION/questions Method: GET Parameters: Pagination parameters: Name | Description | Type | Required | Possible values |
---|
max | Limits the number of resources requested to return. | Integer | no | | offset | Tells where to start returning records from the entire set of results. | Integer | no | | order | Orders ascending or descending. | Integer | no | asc,desc | sort | Orders the results by the specified field. | String | no | |
The max parameter is set to 100 by default. Filters parameters:
Name | Description | Type | Required | Example values |
---|
dateCreated_gt | Filters by the resource's creation date time and operator greater than | Date | no | 2016-08-15T14:52:48Z | dateCreated_gte | Filters by the resource's creation date time and operator greater than or equal | Date | no | | dateCreated_lt | Filters by the resource's creation date time and operator less than | Date | no | | dateCreated_lte | Filters by the resource's creation date time and operator less than or equal | Date | no | | lastUpdated_gt | Filters by the resource's last-modified date time and operator greater than | Date | no | | lastUpdated_gte | Filters by the resource's last-modified date time and operator greater than or equal | Date | no | | lastUpdated_lt | Filters by the resource's last-modified date time and operator less than | Date | no | | lastUpdated_lte | Filters by the resource's last-modified date time and operator less than or equal | Date | no | | surveyName | Wildcard search by the survey's name | String | no | surveyName=*Quality of product* | type | Search by the resource's type | Integer | no | 1, 2, 3 |
Dates should be formatted as the ISO-8601 format (YYYY-MM-DDTHH:MM:SSZ)
Success OutputSuccess case: response.status = 200 {
"paging": {
"total": 1,
"max": 100,
"offset": 0,
"previous": null,
"next": null
},
"data": [
{
"id": 7,
"survey": {
"id": 4,
"name": "Quality and satisfaction with documentation",
"href": "/api/v1.0/surveys/4"
},
"text": "How satisfied are you with the appropriateness of the documentation to your needs?",
"type": "2",
"isMandatory": true,
"isPhotoMandatory": false,
"enabled": true,
"questionOptions": [
{
"id": 10,
"text": "Satisfied",
"href": "/api/v1.0/questionOptions/10"
},
{
"id": 11,
"text": "Dissatisfied",
"href": "/api/v1.0/questionOptions/11"
},
{
"id": 12,
"text": "Neutral",
"href": "/api/v1.0/questionOptions/12"
}
],
"answers": [],
"questionLines": null,
"questionColumns": null,
"dynamicLines": false,
"addFilterByCategory": false,
"organization": "entity1",
"dateCreated": "2016-08-29T10:01:57Z",
"lastUpdated": "2016-08-29T10:20:10Z"
}
]
}
Failure Output Failure case:response.status = 400 {
"error": "invalid_param",
"error_description": "The parameters [dateCreated_gta] you provided are not valid for this request."
}
{
"error": "invalid_datetime_format",
"error_description": "Invalid datetime filter (not ISO-8601 formatted): [2016/08/29]"
} Failure case:response.status = 500
{
"error": "server_error",
"error_description": "Oops! Something went wrong..."
}
66.2 Show
Service: Show a question Description: This web service return an existing question of the specified id in JSON format URL: https://BASE_URL/api/VERSION/questions/{id} Method: GET Parameters: Name | Description | Type | Required | Example values |
---|
id | The numerical ID of the desired question | Long | Yes | 777 |
Success Output Success case: response.status = 200 {
"id": 7,
"survey": {
"id": 4,
"name": "Quality and satisfaction with documentation",
"href": "/api/v1.0/surveys/4"
},
"text": "How satisfied are you with the appropriateness of the documentation to your needs?",
"type": "2",
"isMandatory": true,
"isPhotoMandatory": false,
"enabled": true,
"questionOptions": [
{
"id": 10,
"text": "Satisfied",
"href": "/api/v1.0/questionOptions/10"
},
{
"id": 11,
"text": "Dissatisfied",
"href": "/api/v1.0/questionOptions/11"
},
{
"id": 12,
"text": "Neutral",
"href": "/api/v1.0/questionOptions/12"
}
],
"answers": [],
"questionLines": null,
"questionColumns": null,
"dynamicLines": false,
"addFilterByCategory": false,
"organization": "entity1",
"dateCreated": "2016-08-29T10:01:57Z",
"lastUpdated": "2016-08-29T10:20:10Z"
}
Failure Output Failure case: response.status = 400
{
"error": "invalid_param_type",
"error_description": "The type of parameter id you provided is not valid for this request."
} Failure case: response.status = 404
{
"error": "not_found",
"error_description": "The question with the id 99 doesn't exist."
}
66.3 Create
Service: Create a question Description: Returns the created question in json format when successful. Returns a json response, describing the failure condition when unsuccessful. URL: https://BASE_URL/api/VERSION/questions Method: POST Request content type: application/json
Parameters: Name | Description | Type | Required | Example values |
---|
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 |
Parameters: questionOptions
Name | Description | Type | Required | Example values |
---|
text | text describing the option | String | yes | 'good' , 'bad' | branch | id of the question to be branched with the destined option | Long | no | 77 |
the branch parameter is considered only for those two type of questions unique choice and the drop down list Success Output Success case: response.status = 201 {
"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": "save_not_authorized",
"error_description": "Survey with id 4 has already answers"
}
{
"error": "missing_param",
"error_description": "questionOptions parameter is missing"
}
{
"error": "invalid_param_type",
"error_description": "An invalid value was specified for parameter: type (must be in list)"
}
{
"error": "invalid_param_type",
"error_description": "An invalid value was specified for parameter: isPhotoMandatory (must be Boolean)"
} Failure case: response.status = 404
{
"error": "not_found",
"error_description": "The survey with the id 4 doesn't exist."
}
66.4 Update
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."
}
66.5 Delete
Service: Delete a question Description: Returns a JSON response. URL: https://BASE_URL/api/VERSION/questions/{id} Method: DELETE Parameters: Name | Description | Type | Required | Example values |
---|
id | The numerical ID of the desired question | Integer | yes | 123 |
Success Output Success case: response.status = 200 {
"success": "true",
"success_description": "Instance deleted successfully"
}
Failure Output Failure case: response.status = 400 {
"error": "delete_failed",
"error_description": "Failed to delete instance."
}
{
"error": "delete_not_authorized",
"error_description": "Question with answers could not be deleted"
}
Failure case: response.status = 404 {
"error": "not_found",
"error_description": "The question with the id 123 doesn't exist."
}
|
|