API : Get Poll Details
Check the Polls App.
End Point (Basic)
METHOD : GET
https://mocker.in/api/polls/POLL_ID
Poll ID should be replaced by your actual poll id. This end point will provide you with basic details only. No parameters are required.
Response
{
"status": "success",
"message": "Your poll details",
"data": {
"slug": "G5P9I9",
"question": "My first Api test",
"options": {
"1": "1",
"2": "2",
"3": "3",
"4": "4"
},
"responses": {
"2": 1,
"1": 0,
"3": 0,
"4": 0
},
"is_active": true,
"multiple_answers": false,
"response_count": 1,
"created_at": "28-05-2020 12:47 AM",
"updated_at": "28-05-2020 12:47 AM",
"date_format": "d-m-Y h:i A",
"poll_url": "https://mocker.in/p/G5P9I9",
"results_url": "https://mocker.in/p/G5P9I9/results"
}
}
The reponse will always return two parameters, status and message. If status is success then the action is complete. and if it is error then that means some problem has occured. The problem details can be found in the message parameter. The data parameter will have the poll details. It will also provide you with the total responses in the response_count field as well as all the responses in the responses field.
End Point (Detailed)
METHOD : GET
https://mocker.in/api/polls/POLL_ID/EDIT_PASSWORD
Poll ID and EDIT_PASSWORD should be replaced by your actual poll id. This end point will provide you with basic details only. No parameters are required.
Response
{
"status": "success",
"message": "Your poll details",
"data": {
"slug": "PNZfsIK",
"question": "dsfsdf",
"options": {
"1": "sdf",
"2": "sdf",
"3": "sdf",
"4": "sdf"
},
"responses": {
"1": 0,
"2": 0,
"3": 0,
"4": 0
},
"is_active": true,
"multiple_answers": false,
"user_password": null,
"active_from": null,
"active_till": null,
"edit_password": "33GcPAsapJz7",
"response_count": 0,
"created_at": "28-05-2020 02:54 AM",
"updated_at": "28-05-2020 02:54 AM",
"date_format": "d-m-Y h:i A",
"poll_url": "https://mocker.in/p/PNZfIK",
"results_url": "https://mocker.in/p/PNZfIK/results"
}
}
The reponse will always return two parameters, status and message. If status is success then the action is complete. and if it is error then that means some problem has occured. The problem details can be found in the message parameter. The data parameter will have the poll details. The detailed response also has user_password and edit_password fields.
