Survey API guide
- Flaviu Porutiu
Table of contents |
---|
This edge is only active for the instances that have the survey module active.
If it's not active, all endpoints will return a success = 0 message.
Getting the default feedback survey
Returns the default feedback survey link.
This endpoint can only be used after setting a default survey using the root account on the platform.
If no default survey is set, the endpoint will return a success = 0.
GET /survey/default_scale
Request
Request | ||||||||
---|---|---|---|---|---|---|---|---|
Endpoint: /survey/default_scale | ||||||||
Method: GET | ||||||||
Only logged in: YES | ||||||||
Account privilege restriction: Any privilege | ||||||||
Headers: Click here to expand...
|
Response
Response | ||||||||
Http Code | Response | Description | ||||||
---|---|---|---|---|---|---|---|---|
200 | Success response Success response { "success": 1, "message": "link_to_survey" } | Success response Base Object Base object:
| ||||||
403 | Forbidden | User cannot access the resource |
Assigning / getting the scale for the user
Returns the survey data for the currently assigned scale or assigns a new one if a link is given.
GET /survey/get
Request
Request | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Endpoint: /survey/get | ||||||||||
Method: GET | ||||||||||
Only logged in: YES | ||||||||||
Account privilege restriction: Any privilege | ||||||||||
Headers: Click here to expand...
| ||||||||||
Parameters: Click here to expand...
|
Response
Response | ||||||||||||||||||||||||||||||||||||||||||||||
Http Code | Response | Description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
200 | Success response Success response { "success": 1, "instance_id": 28, "scale": { "id": 15, "title": "Feedback form", "description": "<p>Please fill out this feedback form!</p>", "type": 2 }, "items": [ { "id": 20, "title": "What do you think about our gym?", "position": 1, "answers": { "2": { "id": 2, "title": "Goodn't :(", "position": 1, "value": 0 }, "13": { "id": 13, "title": "Good", "position": 2, "value": 0 } }, "actual_answer": "", "actual_value": "" }, { "id": 21, "title": "What do you think about our offers?", "position": 2, "answers": { "2": { "id": 2, "title": "Goodn't :(", "position": 1, "value": 0 }, "13": { "id": 13, "title": "Good", "position": 2, "value": 0 } }, "actual_answer": "", "actual_value": "" } ] } | Success response Base Object Base object:
scale object scale object:
items object items object:
answers object answers object: Object of type ID - Properties
| ||||||||||||||||||||||||||||||||||||||||||||
403 | Forbidden | User cannot access the resource |
Responding to a survey
POST /survey/save
Request
Request | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Endpoint: /survey/save | ||||||||||||||||||||||||||||||
Method: POST | ||||||||||||||||||||||||||||||
Only logged in: YES | ||||||||||||||||||||||||||||||
Account privilege restriction: Any privilege | ||||||||||||||||||||||||||||||
Headers: Click here to expand...
| ||||||||||||||||||||||||||||||
Parameters: Click here to expand...
|
Response
Response | ||||||
Http Code | Response | Description | ||||
---|---|---|---|---|---|---|
200 | Success response Success response { "success": 1, } | Success response Base Object Base object:
| ||||
403 | Forbidden | User cannot access the resource |
Canceling a survey
Cancels the survey answers for the given instance
This endpoint only works for type = 2 surveys
DELETE /survey/cancel/{survey_instance_id}
Request
Request | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
Endpoint: /survey/delete/{survey_instance_id} | ||||||||||
Method: DELETE | ||||||||||
Only logged in: YES | ||||||||||
Account privilege restriction: Any privilege | ||||||||||
Headers: Click here to expand...
| ||||||||||
Parameters: Click here to expand...
|
Response
Response | ||||||
Http Code | Response | Description | ||||
---|---|---|---|---|---|---|
200 | Success response Success response { "success": 1, } | Success response Base Object Base object:
| ||||
403 | Forbidden | User cannot access the resource |