API – Survey report
- To get the survey report you need to send GET request to the following URI http://localhost:8080/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 'http://localhost:8080/api/rest.php/polls/123/results?action=get-report&filter[pollId]=123' -H 'Authorization: Bearer xxxxxx' -H 'Content-Type: application/json;charset=UTF-8'
Instead of a local address http://localhost:8080 you need to use your server address.
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
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 'http://localhost:8080/api/rest.php/polls/123/results?action=get-report&filter[pollId]=123&filter[userId]=1' -H 'Authorization: Bearer xxxxxx' -H 'Content-Type: application/json;charset=UTF-8'
- In case of error (HTTP response code - 400) it returns JSON object with error information