From d0f1ffc4563d338e134bd105ef736e9901db14b1 Mon Sep 17 00:00:00 2001 From: Tagadda <36127788+Tagadda@users.noreply.github.com> Date: Mon, 13 Aug 2018 13:50:31 +0200 Subject: [PATCH] Some more documentaion --- API.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 4 +++- 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 API.md diff --git a/API.md b/API.md new file mode 100644 index 0000000..1f597f7 --- /dev/null +++ b/API.md @@ -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 | diff --git a/README.md b/README.md index f32fa59..300c44c 100644 --- a/README.md +++ b/README.md @@ -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). \ No newline at end of file