API – Survey report
Use the API token for authorization. Read more in the article API token
- To get the survey report you need to send GET request to the following URI https://your-domain.davintoo.com/api/rest.php/polls/{pollId}/results?action=get-report&filter[pollId]={pollId}
- The request must contain the headings Content-Type: application/json;charset=UTF-8 and Authorization: Bearer xxxxxx.
Request example:
curl 'https://your-domain.davintoo.com/api/rest.php/polls/430/results?action=get-report&filter[pollId]=430' -H 'Authorization: Bearer xxxxxx' -H 'Content-Type: application/json;charset=UTF-8'
Instead of a local address https://your-domain.davintoo.com you need to use your server instance.
The request supports filtering by the following fields:
taskId - Task ID
userId - User ID
city - City
department - Department
Example of a request with a search by user ID:
curl 'https://your-domain.davintoo.com/api/rest.php/polls/430/results?action=get-report&filter[pollId]=430&filter[userId]=4180' -H 'Authorization: Bearer xxxxxx' -H 'Content-Type: application/json;charset=UTF-8'
Answer
- In case of successful request (HTTP response code - 200), the following result will be returned:
- results arraydata
- pagination object (information about the number of pages, the current page, the number of results)pager
- In case of error (HTTP response code - 400) it returns JSON object with error information