1
0
mirror of https://git.cant.at/Madeorsk/PollVerlaine synced 2024-11-25 03:34:33 +01:00
PollVerlaine/API.md

68 lines
1.8 KiB
Markdown
Raw Normal View History

2018-08-13 13:50:31 +02:00
# VerlainePoll's API
## Methods
### Create a poll
```
POST /polls
```
| Field | Description | Optional |
| -------------- | ------------------------------------ | ---------- |
| `title` | The question. | no |
| `options` | All the options. Array of strings. | no |
| `settings` | A Settings object. | yes |
Return a Poll.
### Retrieve a poll
```
GET /polls/:id
```
Return a Poll.
### Vote
```
POST /polls/:id/vote
```
| Field | Description | Optional |
| -------------- | -------------------------------------------- | ---------- |
| `options` | Options you want to vote for. Array of ids. | no |
Return a Poll.
### Delete a poll
```
DELETE /polls/:id
```
Return a Poll.
## Entities
### Poll
| 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 |
### Options
| Attribute | Description | Nullable |
| --------------- | ------------------------------------ | ---------- |
| `label` | The option. | no |
### Settings
| Attribute | Description | Nullable |
| --------------- | ------------------------------------ | ---------- |
| `unique_ip` | One vote per IP address. Boolean. | yes |