documentation/api-documentation.md

681 lines
15 KiB
Markdown
Raw Normal View History

2020-04-14 11:49:10 +00:00
## API Documentation
---
2020-04-14 11:49:10 +00:00
> Values required in **`bold`**.
### **Accounts** | `account`
| field | data type | metadata |
| :------------ | :--------------- | :-------------------------- |
| id | unsigned integer | primary key, auto-increment |
| username | varchar | required |
2020-05-02 19:08:24 +00:00
| email | varchar | required, unique |
| password | varchar | required |
| timezone | varchar | |
| earliest_time | varchar | |
| latest_time | varchar | |
| created_at | datetime | generated by database |
2020-05-02 19:08:24 +00:00
| updated_at | datetime | generated by database |
2020-04-14 11:49:10 +00:00
#### Add an account
2020-04-14 11:49:10 +00:00
**`POST /api/accounts`**
##### Request
2020-04-14 11:49:10 +00:00
A json object for the account to register with **`username`**, **`email`**, **`password`**, `timezone`, `earliest_time` and `latest_time`.
```
{
"username": "jean",
"email": "jean@example.com",
"password": "really-strong-password",
"timezone": "Europe/Brussels",
"earliest_time":"09:30 AM",
"latest_time":"10:00 PM"
}
```
##### Response `201`
2020-04-14 11:49:10 +00:00
A json object for the registered account with `id`, `username`, `email`, `timezone`, `earliest_time` and `latest_time`.
```
{
2020-05-04 13:14:28 +00:00
"id": 1,
"username": "jean",
"email": "jean@example.com",
"timezone": "Europe/Brussels",
"earliest_time":"09:30 AM",
"latest_time":"10:00 PM"
2020-04-14 11:49:10 +00:00
}
```
#### Log in an account
2020-04-14 11:49:10 +00:00
**`POST /api/accounts/login`**
##### Request
2020-04-14 11:49:10 +00:00
A json object for the account to login with either **`email`** or **`username`**, and **`password`** .
```
{
"username": "jean",
"password": "super-strong-password"
}
```
##### Response `201`
2020-04-14 11:49:10 +00:00
A json object for the registered account with `id`, `username`, `email`, `timezone`, `earliest_time` and `latest_time`.
```
{
2020-05-04 13:14:28 +00:00
"id": 1,
"username": "jean",
"email": "jean@example.com",
"timezone": "Europe/Brussels",
"earliest_time":"09:30 AM",
"latest_time":"10:00 PM"l
2020-04-14 11:49:10 +00:00
}
```
#### Update an account
2020-04-14 11:49:10 +00:00
**`PUT /api/accounts/:id`**
##### Request
2020-04-14 11:49:10 +00:00
A json object for the account to register with `id` and any of `username`, `email`, `password`, `timezone`, `earliest_time`, `latest_time`.
```
{
"earliest_time": "08:30 AM",
"latest_time": "08:00 PM"
}
```
##### Response `200`
2020-04-14 11:49:10 +00:00
A json object for the registered account with `id`, `username`, `email`, `timezone`, `earliest_time` and `latest_time`.
```
{
2020-05-04 13:14:28 +00:00
"id": 1,
"username": "jean",
"email": "jean@example.com",
"timezone": "Europe/Brussels",
"earliest_time": "09:30 AM",
"latest_time": "10:00 PM"
2020-04-14 11:49:10 +00:00
}
```
#### Delete an account
2020-04-14 11:49:10 +00:00
**`DELETE /api/accounts/:id`**
##### Request
2020-05-04 13:36:16 +00:00
A json object for the account to delete with `token`.
2020-04-14 11:49:10 +00:00
```
{
2020-05-04 13:36:16 +00:00
"token": "dsdfs-sdfsf-fefzefz-fzef"
2020-04-14 11:49:10 +00:00
}
```
##### Response `200`
2020-05-04 13:14:28 +00:00
A json object for the deleted account with confirmation message.
2020-04-14 11:49:10 +00:00
```
{
2020-05-04 13:14:28 +00:00
"message": "Account with id 15 successfully deleted."
2020-04-14 11:49:10 +00:00
}
```
#### Get a list of meetings for an account
2020-04-14 11:49:10 +00:00
**`GET /api/accounts/:account_id/meetings`**
##### Request
2020-05-04 13:36:16 +00:00
A json object with an `token`.
2020-04-14 11:49:10 +00:00
```
{
2020-05-04 13:36:16 +00:00
"token": "qsd-qsdqd-dfsdfsfsd-sdfsdfs"
2020-04-14 11:49:10 +00:00
}
```
##### Response `200`
2020-04-14 11:49:10 +00:00
A json object for the specified account with an array of `meeting`.
```
2020-05-04 13:14:28 +00:00
[{
"id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"title": "Worldwide strategy meeting for growth",
"description": "Let's find the best ethical growth hacking technics together. Yeah, fun.",
"start_time": "2022-02-16 20:00:00",
"timezone": "Europe/Brussels",
"duration": 60,
"status": 1
},
{
"id": "follow-up-with-tech-team-21850",
"title": "Follow up with tech team",
"duration": 120,
"status": 0
}
]
2020-04-14 11:49:10 +00:00
```
### **Meetings** | `meeting`
| field | data type | metadata |
| :---------- | :-------- | :------------------------------------------ |
| id | uuid | primary key, auto-generated |
| title | varchar | required |
| description | varchar | |
| start_time | datetime | |
2020-05-02 19:08:24 +00:00
| timezone | varchar | required |
| duration | int | required |
| status | boolean | required: `0` (proposed) or `1` (confirmed) |
| password | varchar | |
| created_at | datetime | generated by database |
2020-05-02 19:08:24 +00:00
| updated_at | datetime | generated by database |
2020-04-14 11:49:10 +00:00
#### Add a meeting
2020-04-14 11:49:10 +00:00
**`POST /api/meetings`**
##### Request
2020-05-04 13:36:16 +00:00
A json object for the meeting to add with **`title`**, `description`, `start_time`, **`duration`** and `password`.
2020-04-14 11:49:10 +00:00
```
{
"title": "Worldwide strategy meeting for growth",
"description": "Let's find the best ethical growth hacking technics together. Yeah, fun.",
2020-05-04 13:36:16 +00:00
"start_time": "10:00",
"timezone": "Europe/Brussels",
2020-04-14 11:49:10 +00:00
"duration": 90,
2020-05-04 13:36:16 +00:00
"status": 0,
2020-05-04 14:03:39 +00:00
"password": "simple-meeting-password"
2020-04-14 11:49:10 +00:00
}
```
##### Response `201`
2020-04-14 11:49:10 +00:00
A json object for the added meeting with `id`, `title`, `description`, `start_time`, `duration`, `status` and `password`.
```
{
2020-05-04 13:36:16 +00:00
"id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"title": "Worldwide strategy meeting for growth",
"description": "Let's find the best ethical growth hacking technics together. Yeah, fun.",
"start_time": "10:00",
"timezone": "Europe/Brussels",
"duration": 90,
"status": 0,
"password" "simple-meeting-password"
2020-04-14 11:49:10 +00:00
}
```
#### Update a meeting
2020-04-14 11:49:10 +00:00
**`PUT /api/meetings/:id`**
##### Request
2020-05-04 14:03:39 +00:00
A json object for the meeting to update with any of `title`, `description`, `start_time`, `timezone`, `duration`, `status` and `password`.
2020-04-14 11:49:10 +00:00
```
{
"start_time": "2022-02-16 20:00:00",
"timezone": "Europe/Brussels",
"status": 1
}
```
##### Response `200`
2020-04-14 11:49:10 +00:00
A json object for the updated meeting with `id`, `title`, `description`, `start_time`, `timezone`, `duration` and `status`.
```
{
2020-05-04 14:03:39 +00:00
"id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"title": "Worldwide strategy meeting for growth",
"description": "Let's find the best ethical growth hacking technics together.Yeah, fun.",
"start_time": "2022-02-16 20:00:00",
"timezone": "Europe/Brussels",
"duration: 90,
"status": 1
2020-04-14 11:49:10 +00:00
}
```
#### Delete a meeting
2020-04-14 11:49:10 +00:00
**`DELETE /api/meetings/:id`**
##### Request
A json object for the meeting to delete with `id`.
2020-04-14 11:49:10 +00:00
```
{
"id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
2020-04-14 11:49:10 +00:00
}
```
##### Response `200`
A json object for the deleted meeting with `id` and `meeting_title`.
2020-04-14 11:49:10 +00:00
```
{
2020-05-04 14:03:39 +00:00
"message": "Meeting with id f86983db-955e-43b8-be3e-bc92bbeb9b43 successfully deleted."
2020-04-14 11:49:10 +00:00
}
```
#### Get a list of all participants for a meeting
2020-04-14 11:49:10 +00:00
**`GET /api/meetings/:id/participants`**
##### Request
A json object with a `meeting_id`.
2020-04-14 11:49:10 +00:00
```
{
"id": "f86983db-955e-43b8-be3e-bc92bbeb9b43"
2020-04-14 11:49:10 +00:00
}
```
##### Response `200`
2020-04-14 11:49:10 +00:00
A json object for the specified meeting with an array of `participant`.
```
{
"data": [{
"id": 23,
"account_id": 5,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
2020-04-14 11:49:10 +00:00
"earliest_time": "09:30 AM",
"latest_time": "05:00 PM",
"quorum": 1,
"mandatory": 1,
"host": 1,
"answered": 1,
"timezone": "Europe/Brussels"
},
{
"id": 28,
"account_id": 11,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
2020-04-14 11:49:10 +00:00
"earliest_time": "10:00 AM",
"latest_time": "09:00 PM",
"quorum": 0,
"mandatory": 1,
"host": 0,
"answered": 1,
"timezone": "Europe/Brussels"
}
]
}
```
#### Get a list of complete availibility for a meeting
2020-04-14 11:49:10 +00:00
**`GET /api/meetings/:id/availibility`**
##### Request
2020-04-14 11:49:10 +00:00
A json object with a `meeting_id`.
```
{
"id": "f86983db-955e-43b8-be3e-bc92bbeb9b43"
2020-04-14 11:49:10 +00:00
}
```
##### Response `200`
2020-04-14 11:49:10 +00:00
A json object for the specified meeting with an array of `participant`.
```
{
"data": {
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
2020-04-14 11:49:10 +00:00
"availibility": [{
"participant_id": 5,
"possible_date_id": 21,
"intervals": [{
"preference": 0,
"start_time": "2021-06-25 09:00:00",
"end_time": "2021-06-25 13:00:00",
"timezone": "Europe/Brussels"
},
{
"preference": 1,
"start_time": "2021-06-25 15:00:00",
"end_time": "2021-06-25 20:00:00",
"timezone": "Europe/Brussels"
}]
},
{
"participant_id": 56,
"possible_date_id": 21,
"intervals": [{
"preference": 0,
"start_time": "2021-06-25 08:00:00",
"end_time": "2021-06-25 10:30:00",
"timezone": "Europe/Brussels"
}]
}
]
}
}
```
### **Participants** | `participant`
2020-04-14 11:49:10 +00:00
| field | data type | metadata |
| :------------ | :-------- | :-------------------------- |
| id | int | primary key, auto-increment |
| account_id | varchar | required |
2020-04-14 11:49:10 +00:00
| meeting_id | varchar | required |
| earliest_time | datetime | |
| latest_time | datetime | |
| quorum | boolean | `0` (no) or `1` (yes) |
| mandatory | boolean | `0` (no) or `1` (yes) |
| host | boolean | `0` (no) or `1` (yes) |
| answered | boolean | `0` (no) or `1` (yes) |
| timezone | varchar | required |
| created_at | datetime | generated by database |
2020-05-02 19:08:24 +00:00
| updated_at | datetime | generated by database |
2020-04-14 11:49:10 +00:00
#### Invite a participant
2020-04-14 11:49:10 +00:00
**`POST /api/participants`**
##### Request
2020-04-14 11:49:10 +00:00
A json object for the participant to add with **`account_id`**, **`meeting_id`**, **`earliest_time`**, **`latest_time`**, **`quorum`**, **`mandatory`**, **`host`**, **`answered`** and **`timezone`**.
```
{
"account_id": 5,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
2020-04-14 11:49:10 +00:00
"earliest_time": "08:30 AM",
"latest_time": "08:00 PM",
"quorum": 0,
"mandatory": 1,
"host": 0,
"answered": 0,
"timezone": "Europe/Brussels"
}
```
##### Response `201`
2020-04-14 11:49:10 +00:00
A json object for the participant with `id`, `account_id`, `meeting_id`, `earliest_time`, `latest_time`, `quorum`, `mandatory`, `host`, `answered` and `timezone`.
```
{
"data": {
"id": 23,
"account_id": 5,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
2020-04-14 11:49:10 +00:00
"earliest_time": "08:30 AM",
"latest_time": "08:00 PM",
"quorum": 0,
"mandatory": 1,
"host": 0,
"answered": 0,
"timezone": "Europe/Brussels"
}
}
```
#### Update a participant
2020-04-14 11:49:10 +00:00
**`PUT /api/participants/:id`**
##### Request
2020-04-14 11:49:10 +00:00
A json object for the participant to invite with `id` and any of `id`, `earliest_time`, `latest_time`, `quorum`, `mandatory`, `host`, `answered` and `timezone`.
```
{
"account_id": 5,
"earliest_time": "09:30 AM",
"latest_time": "05:00 PM",
"quorum": 1,
"host": 1,
"answered": 1,
}
```
##### Response `200`
2020-04-14 11:49:10 +00:00
A json object for the participant with `id`, `account_id`, `meeting_id`, `earliest_time`, `latest_time`, `quorum`, `mandatory`, `host`, `answered` and `timezone`.
```
{
"data": {
"id": 23,
"account_id": 5,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
2020-04-14 11:49:10 +00:00
"earliest_time": "09:30 AM",
"latest_time": "05:00 PM",
"quorum": 1,
"mandatory": 1,
"host": 1,
"answered": 1,
"timezone": "Europe/Brussels"
}
}
```
#### Delete a participant
2020-04-14 11:49:10 +00:00
**`DELETE /api/participants/:id`**
##### Request
2020-04-14 11:49:10 +00:00
A json object for the participant to delete with `id`.
```
{
"id": 23
}
```
##### Response
A json object for the deleted participant with `participant_username`, `participant_username` and `meeting_title`.
2020-04-14 11:49:10 +00:00
```
{
"data": {
"participant_username": "Sylvia",
"participant_email": "sylvia@email.com",
"meeting_title": "Worldwide strategy meeting for growth"
}
2020-04-14 11:49:10 +00:00
}
```
2020-05-02 19:08:24 +00:00
### **Possible Dates** | `possible_date`
| field | data type | metadata |
| :------------ | :-------- | :-------------------------- |
| id | int | primary key, auto-increment |
| meeting_id | varchar | foreign key, required |
| possible_date | date | required |
| created_at | datetime | generated by database |
| updated_at | datetime | generated by database |
#### Add a possible date
**`POST /api/possible-dates`**
##### Request
A json object for the meeting to add with **`meeting_id`** and **`possible_date`**.
```
{
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"possible_date": "2020-02-18"
}
```
##### Response `201`
A json object for the added meeting with `id`, `meeting_id` and `possible_date`.
```
{
"data": {
"id": 5,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"possible_date": "2020-02-18"
}
}
```
#### Delete a possible date
**`DELETE /api/possible-dates/:id`**
##### Request
A json object for the possible date to delete with `id`.
```
{
"id": 12
}
```
##### Response `200`
A json object for the deleted possible date with `id`, `meeting_id` and `possible_date`.
```
{
"data": {
"id": 12,
"meeting_id": "f86983db-955e-43b8-be3e-bc92bbeb9b43",
"possible_date": "2020-02-18"
}
}
```
### **Availibility** | `availibility`
2020-04-14 11:49:10 +00:00
| field | data type | metadata |
| :--------------- | :-------- | :--------------------------------- |
| id | int | primary key, auto-increment |
| participant_id | int | foreign key, required |
| possible_date_id | int | foreign key, required |
| preference | boolean | `0` (ideal) or `1` (yes), required |
| start_time | timestamp | required |
| end_time | timestamp | required |
| timezone | varchar | required |
| created_at | datetime | generated by database |
2020-05-02 19:08:24 +00:00
| updated_at | datetime | generated by database |
2020-04-14 11:49:10 +00:00
GET / DELETE / UPDATE
#### Add an availibility for a possible date
2020-04-14 11:49:10 +00:00
**`POST /api/availibility`**
##### Request
2020-04-14 11:49:10 +00:00
A json object with the availibility to add with **`participant_id`**, **`possible_date_id`** and an array of intervals with **`preference`**, **`start_time`**, **`end_time`** and **`timezone`**.
```
{
"participant_id": 5,
"possible_date_id": 21,
"intervals": [{
"preference": 0,
"start_time": "2021-06-25 09:00:00",
"end_time": "2021-06-25 13:00:00",
"timezone": "Europe/Brussels"
},
{
"preference": 1,
"start_time": "2021-06-25 15:00:00",
"end_time": "2021-06-25 20:00:00",
"timezone": "Europe/Brussels"
}
]
}
```
##### Response `201`
2020-04-14 11:49:10 +00:00
A json object with the availibility to add with **`participant_id`**, **`possible_date_id`** and an array of intervals with **`id`**, **`preference`**, **`start_time`**, **`end_time`** and **`timezone`**.
```
{
"data": {
"participant_id": 5,
"possible_date_id": 21,
"intervals": [{
"id": 45,
"preference": 0,
"start_time": "2021-06-25 09:00:00",
"end_time": "2021-06-25 20:00:00",
"timezone": "Europe/Brussels"
},
{
"id": 46,
"preference": 1,
"start_time": "2021-06-25 09:00:00",
"end_time": "2021-06-25 20:00:00",
"timezone": "Europe/Brussels"
}
]
}
}
```
#### Delete availibility for a possible date
2020-04-14 11:49:10 +00:00
**`DELETE /api/availibility/:id`**
##### Request
2020-04-14 11:49:10 +00:00
A json object for the availibility to delete with **`participant_id`** and **`possible_date_id`**.
```
{
"participant_id": 5,
"possible_date_id": 21
}
```
##### Response `200`
2020-04-14 11:49:10 +00:00
A json object for the deleted availibility with status code and message.
```
{
"data": {
"participant_username": "José",
"possible_date": "2020-05-12"
}
2020-04-14 11:49:10 +00:00
}
2020-04-14 12:03:55 +00:00
```