Poll REST service to fetch poll result
A REST service is available with poll plugin that will provide poll
result details as JSON
format. With poll plugin a web
application named poll-ws.war is provided that
contains the REST services. To get result for a specific poll you have
to send request to the following URI.
http://your-host/poll-ws/poll/poll-id/status
In the above example you must use your host name where poll web service application is deployed and also must use a valid poll Id. For malformed Id like 55Y REST service will return 400 status code. If poll is not found then 404 status will be returned. If poll Id is valid and content is found then it will return poll title, other fields and options in the json format. An example of JSON response is given bellow -
{
"id": "2742",
"title": "Euro 2012 quiz",
"fields": {
"description": "Count your vote",
"question": "Who will win Euro 2012 ?"
},
"options": [
{
"option": svar1,
"value": "Spain",
"vote": 2,
"percentage": "25"
},
{
"option": svar2,
"value": "Germany",
"vote": 4,
"percentage": "50"
},
{
"option": svar3,
"value": "Portugal",
"vote": 1,
"percentage": "12"
},
{
"option": svar4,
"value": "Italy",
"vote": 1,
"percentage": "12"
}
]
}