-
Notifications
You must be signed in to change notification settings - Fork 2
Boards
Stephen McBride edited this page Nov 23, 2020
·
24 revisions
Creates board based on provided params.
Requires session cookie.
POST /boards
Parameter | Type | Description | Requirement Type |
---|---|---|---|
user_id | integer | ID of the user creating the board. | Required |
name | string | Desired name of the board being created. | Required |
let formData = new FormData();
formData.append(board["user_id"], 1);
formData.append(board["name"], "My Board");
fetch(`http://localhost:3000/boards`, {
credentials: 'include',
method: 'post',
body: formData
}).then(response => response.json())
.then(json => ...);
Parameter | Type | Description |
---|---|---|
board_id | integer | ID of the created board. |
user_id | integer | User ID of the created board. |
name | string | Name of the created board. |
{
"board_id": 1, "user_id": 1, "name": "My Board"
}
Shows all boards belonging to a user.
Requires session cookie.
GET /boards
Parameter | Type | Description | Requirement Type |
---|---|---|---|
user_id | integer | ID of the user that owns the board. | Required |
let formData = new FormData();
formData.append(board["user_id"], 1);
fetch(`http://localhost:3000/boards`, {
credentials: 'include',
method: 'get',
body: formData
}).then(response => response.json())
.then(json => ...);
Parameter | Type | Description |
---|---|---|
board_id | integer | ID of the requested board. |
user_id | integer | User ID of the requested board. |
name | string | Name of the requested board. |
[
{
"board_id": 1,
"user_id": 1,
"name": "My Board"
},
{
"board_id": 2,
"user_id": 1,
"name": "My Second Board"
}
]
Shows specific board.
Requires session cookie.
GET /boards/:board_id
None.
fetch(`http://localhost:3000/boards/1`, {
credentials: 'include',
method: 'get',
}).then(response => response.json())
.then(json => ...);
Parameter | Type | Description |
---|---|---|
board_id | integer | ID of the requested board. |
user_id | integer | User ID of the requested board. |
name | string | Name of the requested board. |
{
"board_id": 1,
"user_id": 1,
"name": "My Board"
}
Updates specific board.
Requires session cookie.
PUT /boards/:board_id
Parameter | Type | Description | Requirement Type |
---|---|---|---|
user_id | integer | ID of the user that owns the board. | Optional |
name | string | Desired name of the board being updated. | Optional |
let formData = new FormData();
formData.append(board["user_id"], 1);
formData.append(board["name"], "Updated Name");
fetch(`http://localhost:3000/boards/1`, {
credentials: 'include',
method: 'put',
body: formData
}).then(response => response.json())
.then(json => ...);
Parameter | Type | Description |
---|---|---|
board_id | integer | ID of the updated board. |
user_id | integer | User ID of the updated board. |
name | string | Name of the updated board. |
{
"board_id": 1,
"user_id": 1,
"name": "My Board"
}
Destroys specific board.
Requires session cookie.
DELETE /boards/:board_id
None.
fetch(`http://localhost:3000/boards/1`, {
credentials: 'include',
method: 'delete',
}).then(response => response.json())
.then(json => ...);
None.