Some more documentaion

This commit is contained in:
Tagadda 2018-08-13 13:50:31 +02:00
parent e0b4db74c9
commit d0f1ffc456
2 changed files with 71 additions and 1 deletions

68
API.md Normal file
View File

@ -0,0 +1,68 @@
# 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 |
| --------------- | ------------------------------------ | ---------- |
| `id` | | no |
| `label` | The option. | no |
### Settings
| Attribute | Description | Nullable |
| --------------- | ------------------------------------ | ---------- |
| `unique_ip` | One vote per IP address. Boolean. | yes |

View File

@ -9,7 +9,7 @@ Clone the repository :
mkdir db && touch db/polls.db && composer install
```
Uncomment the dba extention in `php.ini` :
Uncomment the `dba` extention in `php.ini` :
```
extension=dba
```
@ -25,3 +25,5 @@ location /
```
## API
See [API.md](API.md).