The back-end for the Lambda School Build Week Chore Tracking project. There is seperate endpoints for a lot of data and also some combined. Choose endpoints to fit your needs!
HTTP Method: POST
URL: /api/auth/register
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Name | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | First name of parent |
| username | String | Yes | username of parent |
| String | Yes | Parent's email address | |
| password | String | Yes | Parent's chosen password |
{
"name": "Brittany",
"username": "brittany01",
"email": "new@parent.com",
"password": "password"
}201 (Created)
If successfully registered, endpoint will return HTTP response with status code and a body with a token, welcome message and parent information.
400 (Bad Request)
If required information is missing, the endpoint will return an HTTP response with a status code of 400
500 (Internal Server Error)
If there was a server error registering the user, a response with status code 500 will be returned.
HTTP Method: POST
URL: /api/auth/register/:id
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Name | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | First name of child |
| username | String | Yes | username of child |
| password | String | Yes | Child's chosen password |
{
"name": "Michael ",
"username": "michael01",
"password": "password"
}201 (Created)
If successfully registered, endpoint will return HTTP response with status code and a body with a token, welcome message and child information.
400 (Bad Request)
If required information is missing, the endpoint will return an HTTP response with a status code of 400
500 (Internal Server Error)
If there was a server error registering the user, a response with status code 500 will be returned.
HTTP Method: POST
URL: /api/auth/login
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Name | Type | Required | Description |
|---|---|---|---|
| username | String | Yes | username of parent |
| password | String | Yes | parent's password |
{
"username": "brittany01",
"password": "password"
}200 (OK)
If successfully logged in, endpoint will return HTTP response with status code and a body with a token, welcome message and parent's information.
400 (Bad Request)
If required information is missing, the endpoint will return an HTTP response with a status code of 400.
500 (Internal Server Error)
If there was a server error logging in the user, a response with status code 500 will be returned.
HTTP Method: POST
URL: /api/auth/login/child
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Name | Type | Required | Description |
|---|---|---|---|
| username | String | Yes | username of child |
| password | String | Yes | child's password |
{
"username": "michael01",
"password": "password"
}200 (OK)
If successfully logged in, endpoint will return HTTP response with status code and a body with a token, welcome message and child's information.
400 (Bad Request)
If required information is missing, the endpoint will return an HTTP response with a status code of 400.
500 (Internal Server Error)
If there was a server error logging in the user, a response with status code 500 will be returned.
HTTP Method: GET
URL: /api/parent/:id
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Uses the token from login/register |
{
"id": 2,
"username": "steph01",
"name": "Stephanie",
"email": "steph@email.com",
"role": "parent"
}200 (OK)
If successfully found, endpoint will return HTTP response with status code and a body similar to example above
404 (Not Found)
If no user found, status code 404 will be returned
401 (Unauthorized)
If token information does not match user id in URL parameters status code 401 will be returned
500 (Internal Server Error)
If there was a server error registering the user, a response with status code 500 will be returned.
HTTP Method: PUT
URL: /api/parent/:id
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Uses the token from login/register |
| Name | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | First name of parent |
| username | String | Yes | username of parent |
| String | Yes | Parent's email address |
{
"id": 2,
"username": "steph01",
"name": "Stephanie",
"email": "steph@email.com",
"role": "parent"
}200 (OK)
If successfully found, endpoint will return HTTP response with status code and a body similar to example above
404 (Not Found)
If no user found, status code 404 will be returned
401 (Unauthorized)
If token information does not match user id in URL parameters status code 401 will be returned
500 (Internal Server Error)
If there was a server error registering the user, a response with status code 500 will be returned.
HTTP Method: GET
URL: /api/child/:id
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Uses the token from login/register |
{
"id": 2,
"username": "carl01",
"name": "Carlin",
"parent_id": 2,
"role": "child",
"total_points": 0,
"current_streaks": 0,
"highest_points": 0
}200 (OK)
If successfully found, endpoint will return HTTP response with status code and a body similar to example above
404 (Not Found)
If no user found, status code 404 will be returned
401 (Unauthorized)
If token information does not match user id in URL parameters status code 401 will be returned
500 (Internal Server Error)
If there was a server error registering the user, a response with status code 500 will be returned.
HTTP Method: PUT
URL: /api/child/:id
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Uses the token from login/register |
| Name | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | First name of child |
| username | String | Yes | Username of child |
| total_points | String | No | Total points for a child |
| current_streaks | String | No | Chore completing streak |
| highest_points | String | No | Longest running streak |
{
"id": 2,
"username": "carl01",
"name": "Carlin",
"parent_id": 2,
"role": "child",
"total_points": 0,
"current_streaks": 0,
"highest_points": 0
}200 (OK)
If successfully updated, endpoint will return HTTP response with status code and a body similar to example above
400 (Bad Request)
If missing info, status code 400 will be returned
401 (Unauthorized)
If token information does not match user id in URL parameters, status code 401 will be returned
500 (Internal Server Error)
If there was a server error registering the user, a response with status code 500 will be returned.
HTTP Method: GET
URL: /api/parent/combined/:id
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Uses the token from login/register |
{
"parent": {
"id": 2,
"username": "steph01",
"password": "stephanie",
"name": "Stephanie",
"email": "steph@email.com",
"role": "parent"
},
"children": [
{
"id": 2,
"name": "Carlin",
"role": "child",
"parent_id": 2,
"current_streaks": 0,
"total_points": 0,
"highest_points": 0
}
]
}200 (OK)
If successful, endpoint will return a JSON array in the format of the example above.
401 (Unauthorized)
If token information does not match user id in URL parameters, status code 401 will be returned
500 (Internal Server Error)
If there was a server error retrieving the project, a response with status code 500 will be returned.
HTTP Method: GET
URL: /api/parent/children/:id
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Uses the token from login/register |
[
{
"id": 4,
"name": "child1",
"role": "child",
"parent_id": 5,
"current_streaks": 0,
"total_points": 0,
"highest_points": 0
},
{
"id": 5,
"name": "child2",
"role": "child",
"parent_id": 5,
"current_streaks": 0,
"total_points": 0,
"highest_points": 0
}
]200 (OK)
If successful, endpoint will return a JSON array in the format of the example above.
401 (Unauthorized)
If token information does not match user id in URL parameters, status code 401 will be returned
500 (Internal Server Error)
If there was a server error retrieving the project, a response with status code 500 will be returned.
HTTP Method: GET
URL: /api/chores/comChores
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Uses the token from login/register |
[
{
"id": 1,
"name": "Dusting",
"description": "make sure all surfaces are free of dust",
"points": 100,
"createdAt": "2020-02-04 20:19:06",
"updatedAt": "2020-02-04 20:19:06",
"parent_id": 1
},
{
"id": 2,
"name": "Dishes",
"description": "wash, dry and put away all dishes",
"points": 100,
"createdAt": "2020-02-04 20:19:06",
"updatedAt": "2020-02-04 20:19:06",
"parent_id": 1
}
]200 (OK)
If successful, endpoint will return a JSON array in the format of the example above.
401 (Unauthorized)
If token information does not match user id in URL parameters, status code 401 will be returned
500 (Internal Server Error)
If there was a server error retrieving the project, a response with status code 500 will be returned.
HTTP Method: GET
URL: /api/chores/:parentId
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Uses the token from login/register |
[
{
"id": 6,
"name": "testing",
"description": "testing",
"points": 100,
"createdAt": "2020-02-04 20:39:25",
"updatedAt": "2020-02-04 20:39:25",
"parent_id": 2
}
]200 (OK)
If successful, endpoint will return a JSON array in the format of the example above.
401 (Unauthorized)
If token information does not match user id in URL parameters, status code 401 will be returned
500 (Internal Server Error)
If there was a server error retrieving the project, a response with status code 500 will be returned.
HTTP Method: GET
URL: /api/chores/comChores/:parentId
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Uses the token from login/register |
[
{
"id": 1,
"name": "Sweeping Kitchen Floor",
"description": "sweep free of debris",
"points": 100,
"createdAt": "2020-02-04 20:38:34",
"updatedAt": "2020-02-04 20:38:34",
"parent_id": 1
},
{
"id": 2,
"name": "testing",
"description": "testing",
"points": 100,
"createdAt": "2020-02-04 20:39:25",
"updatedAt": "2020-02-04 20:39:25",
"parent_id": 2
}
]200 (OK)
If successful, endpoint will return a JSON array in the format of the example above.
401 (Unauthorized)
If token information does not match user id in URL parameters, status code 401 will be returned
404 (Not Found)
If there is not a parent with that ID, response status 404 will be returned
500 (Internal Server Error)
If there was a server error retrieving the project, a response with status code 500 will be returned.
HTTP Method: POST
URL: /api/chores/:parentId
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Token from registration/login |
| Name | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | Name of Chore |
| description | String | Yes | Description of chore |
{
"name": "chore",
"description": "description of chore"
}201 (Created)
If successfully created, endpoint will return HTTP response with status code 200 and the chore information.
400 (Bad Request)
If required information is missing, the endpoint will return an HTTP response with a status code of 400
401 (Not Authorized)
If token is not provided, the endpoint will return HTTP response with status code 401
500 (Internal Server Error)
If there was a server error creating the project, a response with status code 500 will be returned.
HTTP Method: PUT
URL: /api/chores/chore/:choreId
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Token from registration/login |
| Name | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | Name of Chore |
| description | String | Yes | Description of chore |
{
"name": "updated chore",
"description": "updated description of chore"
}200 (OK)
If successfully updated, endpoint will return HTTP response with status code 200 and the chore information.
400 (Bad Request)
If required information is missing, the endpoint will return an HTTP response with a status code of 400
401 (Not Authorized)
If token is not provided, the endpoint will return HTTP response with status code 401
500 (Internal Server Error)
If there was a server error creating the project, a response with status code 500 will be returned.
HTTP Method: DELETE
URL: /api/chores/chore/:choreId
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Token from registration/login |
200 (OK)
If successfully deleted, endpoint will return HTTP response with status code 200 and a success message.
404 (Not Found)
If there is not a chore with that chore ID, response status 404 will be returned
401 (Not Authorized)
If token is not provided the endpoint will return HTTP response with status code 401
500 (Internal Server Error)
If there was a server error creating the project, a response with status code 500 will be returned.
HTTP Method: POST
URL: /api/chores/child/:id
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Token from registration/login |
| Name | Type | Required | Description |
|---|---|---|---|
| name | String | Yes | Name of Chore |
{
"name": "Laundry"
}201 (Created)
If successfully added, endpoint will return HTTP response with status code 200 and a success message
400 (Bad Request)
If required information is missing, the endpoint will return an HTTP response with a status code of 404
401 (Not Authorized)
If token is not provided, the endpoint will return HTTP response with status code 401
500 (Internal Server Error)
If there was a server error creating the project, a response with status code 500 will be returned.
HTTP Method: DELETE
URL: /api/chores/child/:id/:choreId
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Token from registration/login |
200 (OK)
If successfully deleted, endpoint will return HTTP response with status code 200
404 (Not Found)
If there is not a chore with that chore ID, response status 404 will be returned
401 (Not Authorized)
If token is not provided the endpoint will return HTTP response with status code 401
500 (Internal Server Error)
If there was a server error creating the project, a response with status code 500 will be returned.
HTTP Method: GET
URL: /api/chores/combined/:id
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Uses the token from login/register |
{
"child": {
"id": 2,
"username": "carl01",
"name": "Carlin",
"parent_id": 2,
"role": "child",
"total_points": 0,
"current_streaks": 0,
"highest_points": 0
},
"chores": [
{
"name": "Laundry",
"description": "sort, wash, dry, fold and put away laundry",
"points": 100,
"id": 3,
"completed": 0,
"createdAt": "2020-02-04 20:19:06",
"updatedAt": "2020-02-04 20:19:06"
},
{
"name": "Dusting",
"description": "make sure all surfaces are free of dust",
"points": 100,
"id": 4,
"completed": 0,
"createdAt": "2020-02-04 20:19:06",
"updatedAt": "2020-02-04 20:19:06"
}
]
}200 (OK)
If successful, endpoint will return a JSON array in the format of the example above.
401 (Unauthorized)
If token information does not match user id in URL parameters, status code 401 will be returned
500 (Internal Server Error)
If there was a server error retrieving the project, a response with status code 500 will be returned.
HTTP Method: GET
URL: /api/chores/child/:id
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Uses the token from login/register |
[
{
"name": "Mow the lawn",
"description": "cut the grass and clean up stray cuttings",
"points": 100,
"id": 1,
"completed": 0,
"createdAt": "2020-02-04 20:19:06",
"updatedAt": "2020-02-04 20:19:06"
},
{
"name": "Dishes",
"description": "wash, dry and put away all dishes",
"points": 100,
"id": 2,
"completed": 0,
"createdAt": "2020-02-04 20:19:06",
"updatedAt": "2020-02-04 20:19:06"
}
]200 (OK)
If successful, endpoint will return a JSON array in the format of the example above.
401 (Unauthorized)
If token information does not match user id in URL parameters, status code 401 will be returned
500 (Internal Server Error)
If there was a server error retrieving the project, a response with status code 500 will be returned.
HTTP Method: GET
URL: /api/chores/chore/:id
| Name | Type | Required | Description |
|---|---|---|---|
| Content-Type | String | Yes | Must be application/json |
| Authorization | String | Yes | Uses the token from login/register |
{
"id": 1,
"name": "Dusting",
"description": "make sure all surfaces are free of dust",
"points": 100,
"createdAt": "2020-02-05 17:47:24",
"updatedAt": "2020-02-05 17:47:24",
"parent_id": 1
}200 (OK)
If successful, endpoint will return a JSON array in the format of the example above.
404 (Not Found)
If there is not a chore with that chore ID, response status 404 will be returned
401 (Unauthorized)
If token information does not match user id in URL parameters, status code 401 will be returned
500 (Internal Server Error)
If there was a server error retrieving the project, a response with status code 500 will be returned.