Skip to content
Marc Burgess edited this page Apr 14, 2020 · 6 revisions

All Chores API endpoints require authorisation to enable authorisation follow these steps

  1. Call the user Login endpoint
  2. retrieve the token from the response of the login
  3. add "Bearer <jwt token>" to the Authorisation Header field
  4. Send the Chores API request

Chore DTO:

Parameters Format
Id integer
Title string
Description string
Assignee int (user id)
DueDate datetime string YYYY-MM-DDTHH::MM:SSZ
Completed bool
Recurring bool

/api/Chores/Flat

Method: POST

Description: Add a new chore to the flat, and assign a user to that chore

Body Input

Parameters Format
Chore Chore DTO

Request Body example

{
  "chore_id": 0,
  "title": "dishes",
  "description": "do the dishes and put them away",
  "assignee": 22,
  "due_date": "2020-03-16T04:25:50.783Z",
  "completed": 0,
  "recurring": 0
}

Response

STATUS CODE: 200 OK Added chore successfully

STATUS CODE: 400 BAD REQUEST Assignee id does not exist

STATUS CODE: 401 UNAUTHORIZED User not logged in

/api/Chores/Flat

Method: Get

Description: Returns a list of chores associated with the current flat

Body Input

None

Response

STATUS CODE: 200 OK Returned chores successfully

STATUS CODE: 400 BAD REQUEST User does not belong to a flat

STATUS CODE: 401 UNAUTHORIZED User not logged in

List of Chores DTO

/api/Chores/{ChoreId}

Method: PUT

Description: Mark a chore as completed

Path Input

Parameters Format
chore_id integer

Response

STATUS CODE: 200 OK Chore marked as completed

STATUS CODE: 400 BAD REQUEST Chore id does not exist

STATUS CODE: 401 UNAUTHORIZED User not logged in

/api/Chores/{ChoreId}

Method: DELETE

Description: Remove a chore

Path Input

Parameters Format
chore_id integer

Response

STATUS CODE: 200 OK Chore deleted

STATUS CODE: 400 BAD REQUEST Chore id does not exist

STATUS CODE: 401 UNAUTHORIZED User not logged in

Clone this wiki locally