1
0
mirror of https://git.cant.at/Madeorsk/PollVerlaine synced 2024-11-22 12:54:31 +01:00
PollVerlaine/API.md

71 lines
2.1 KiB
Markdown
Raw Normal View History

2018-08-13 13:50:31 +02:00
# VerlainePoll's API
## Methods
### Create a poll
```
2018-08-16 14:16:50 +02:00
POST /polls
2018-08-13 13:50:31 +02:00
```
| Field | Description | Optional |
| -------------- | ------------------------------------ | ---------- |
| `title` | The question. | no |
| `options` | All the options. Array of strings. | no |
| `settings` | A Settings object. | yes |
2018-08-16 14:16:50 +02:00
Return a Poll with `delete_token`.
2018-08-13 13:50:31 +02:00
### Retrieve a poll
```
GET /polls/:id
```
Return a Poll.
### Vote
```
2018-08-16 14:16:50 +02:00
POST /polls/:id/vote
2018-08-13 13:50:31 +02:00
```
| Field | Description | Optional |
| -------------- | -------------------------------------------- | ---------- |
| `options` | Options you want to vote for. Array of ids. | no |
Return a Poll.
### Delete a poll
```
2018-08-16 14:16:50 +02:00
DELETE /polls/:id/:token
2018-08-13 13:50:31 +02:00
```
Return a Poll.
## Entities
### Poll
2018-08-16 14:16:50 +02:00
| Attribute | Description | Nullable |
| ------------------ | ------------------------------------ | ---------- |
| `id` | | no |
| `title` | The question. | no |
| `options` | All the options. Array of Options. | no |
| `settings` | A Settings object. | no |
| `creation_date` | Creation date. | no |
| `delete_token` | Deletion token. | yes |
2018-08-13 13:50:31 +02:00
### Options
2018-08-16 14:16:50 +02:00
| Attribute | Description | Nullable |
| ------------------ | ------------------------------------ | ---------- |
| `label` | The option. | no |
| `votes` | Numbers of votes. | yes |
2018-08-13 13:50:31 +02:00
### Settings
2018-08-16 14:16:50 +02:00
| Attribute | Description | Nullable |
| ------------------ | ----------------------------------------------- | ---------- |
| `unique_ip` | One vote per IP address. Boolean. | yes |
| `multiple_choices` | Allow multiple choices in one vote. Boolean. | yes |