date-poll-api/examples.md

46 lines
640 B
Markdown
Raw Normal View History

# API example
after having setup your project and database, and having a local server running you can rest these commands
2019-11-28 14:16:56 +01:00
## get Swagger configuration
```
GET
http://127.0.0.1:8000/api/doc.json
```
## create a poll
```
POST
http://127.0.0.1:8000/api/v1/poll/new
Content-Type:"application/json"
```
## add a vote to an existing poll
```
POST
http://127.0.0.1:8000/api/v1/poll/98/vote
2019-11-28 14:16:56 +01:00
Content-Type:"application/json"
{
"pseudo": "Mario Bros",
"email": "MarioBros@tktest.com",
"votes": [{
2019-11-28 11:56:06 +01:00
"choice_id": 5,
"value": "yes"
},
{
2019-11-28 11:56:06 +01:00
"choice_id": 6,
"value": "no"
},
{
2019-11-28 11:56:06 +01:00
"choice_id": 7,
"value": "maybe"
}]
}
2019-11-28 11:56:06 +01:00
```