API for the empathy builder calculator for freeform.org.
POST auth/login
| Name | Type | Description |
|---|---|---|
| username | String | User's username |
| password | String | User's password |
Success-Response:
HTTP 201 Created
{
"user_id": 3,
"username": "abc123",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWJqZWN0IjoxLCJ1c2VybmFtZSI6InRlc3QxIiwiaWF0IjoxNTY3MDE4OTcxLCJleHAiOjE1NjcwMzMzNzF9.75Q_EUManFaIczoccxkSC9LgFRm-zC5w3eeAHuhIWsg"
}
Error-Response
HTTP 400 MissingData
{
"error": "Please send both username and password."
}
POST auth/register
| Name | Type | Description |
|---|---|---|
| username | String | User's unique username |
| password | String | User's password |
Success-Response:
HTTP 201 Created
{
"user_id": 3,
"username": "abc123"
}
Error-Response
HTTP 400 MissingData
{
"error": "Please send both username and password."
}
DEL budgets/:id
| Name | Type | Description |
|---|---|---|
| authorization | String | User's unique authorization token |
Success-Response:
HTTP 200 OK
[
{
"budget_name_id": 1,
"budget_name": "Denver",
"created_at": "2019-08-26T19:49:28.206Z",
"updated_at": "2019-08-26T19:49:28.206Z",
"user_id": 1
}
]
Error-Response
HTTP 400 MissingToken
{
"error": "No token provided. Please include a token in your authorization header."
}
GET budgets/:id
| Name | Type | Description |
|---|---|---|
| authorization | String | User's unique authorization token |
Success-Response:
HTTP 200 OK
[
{
"line_id": 1,
"amount": 80,
"category_id": 1,
"category_name": "Car Payment"
},
{
"line_id": 4,
"amount": 0,
"category_id": 2,
"category_name": "Car Insurance"
},
{
"line_id": 7,
"amount": 0,
"category_id": 3,
"category_name": "Gas & Car Maintenance"
},
]
Error-Response
HTTP 400 MissingToken
{
"error": "No token provided. Please include a token in your authorization header."
}
GET budgets/
| Name | Type | Description |
|---|---|---|
| authorization | String | User's unique authorization token |
Success-Response:
HTTP 200 OK
[
{
"budget_name_id": 1,
"budget_name": "Denver",
"created_at": "2019-08-26T19:49:28.206Z",
"updated_at": "2019-08-26T19:49:28.206Z",
"user_id": 1
}
]
Error-Response
HTTP 400 MissingToken
{
"error": "No token provided. Please include a token in your authorization header."
}
POST budgets/:id
| Name | Type | Description |
|---|---|---|
| authorization | String | User's unique authorization token |
Success-Response:
HTTP 200 OK
[
{
"line_id": 1,
"amount": 80,
"category_id": 1,
"category_name": "Car Payment"
},
{
"line_id": 4,
"amount": 0,
"category_id": 2,
"category_name": "Car Insurance"
},
{
"line_id": 7,
"amount": 0,
"category_id": 3,
"category_name": "Gas & Car Maintenance"
},
]
Error-Response
HTTP 400 MissingToken
{
"error": "No token provided. Please include a token in your authorization header."
}
POST budgets/
| Name | Type | Description |
|---|---|---|
| authorization | String | User's unique authorization token |
Success-Response:
HTTP 200 OK
{
"budget_name_id": 1,
"budget_name": "Denver",
"created_at": "2019-08-26T19:49:28.206Z",
"updated_at": "2019-08-26T19:49:28.206Z",
"user_id": 1
}
Error-Response
HTTP 400 MissingToken
{
"error": "No token provided. Please include a token in your authorization header."
}
PUT budgets/:id/lines
| Name | Type | Description |
|---|---|---|
| authorization | String | User's unique authorization token |
Success-Response:
HTTP 200 OK
[
{
"line_id": 1,
"amount": 80,
"category_id": 1,
"category_name": "Car Payment"
},
{
"line_id": 4,
"amount": 0,
"category_id": 2,
"category_name": "Car Insurance"
},
{
"line_id": 7,
"amount": 0,
"category_id": 3,
"category_name": "Gas & Car Maintenance"
},
]
Error-Response
HTTP 400 MissingToken
{
"error": "No token provided. Please include a token in your authorization header."
}
PUT budgets/:id
| Name | Type | Description |
|---|---|---|
| authorization | String | User's unique authorization token |
Success-Response:
HTTP 200 OK
[
{
"budget_name_id": 1,
"budget_name": "Denver",
"created_at": "2019-08-26T19:49:28.206Z",
"updated_at": "2019-08-26T19:49:28.206Z",
"user_id": 1
}
]
Error-Response
HTTP 400 MissingToken
{
"error": "No token provided. Please include a token in your authorization header."
}
DELETE categories/:id
| Name | Type | Description |
|---|---|---|
| authorization | String | User's unique authorization token |
| Name | Type | Description |
|---|---|---|
| ID | Number | Category's ID |
Success-Response:
HTTP 200 OK
[
{
"category_id": 1,
"category_name": "Car Payment",
"category_type": "Personal",
"user_id": null
},
{
"category_id": 2,
"category_name": "Car Insurance",
"category_type": "Personal",
"user_id": null
},
{
"category_id": 3,
"category_name": "Gas & Car Maintenance",
"category_type": "Personal",
"user_id": null
}
]
Error-Response
HTTP 400 MissingToken
{
"error": "No token provided. Please include a token in your authorization header."
}
GET categories/
| Name | Type | Description |
|---|---|---|
| authorization | String | User's unique authorization token |
Success-Response:
HTTP 200 OK
[
{
"category_id": 1,
"category_name": "Car Payment",
"category_type": "Personal",
"user_id": null
},
{
"category_id": 2,
"category_name": "Car Insurance",
"category_type": "Personal",
"user_id": null
},
{
"category_id": 3,
"category_name": "Gas & Car Maintenance",
"category_type": "Personal",
"user_id": null
}
]
Error-Response
HTTP 400 MissingToken
{
"error": "No token provided. Please include a token in your authorization header."
}
POST categories/
| Name | Type | Description |
|---|---|---|
| authorization | String | User's unique authorization token |
| Name | Type | Description |
|---|---|---|
| category_name | String | Category's name |
| category_type | String | Either personal or relocation |
Success-Response:
HTTP 201 Created
{
"category_id": 24,
"category_name": "Test234",
"category_type": "Personal",
"user_id": 1
}
Error-Response
HTTP 400 MissingToken
{
"error": "No token provided. Please include a token in your authorization header."
}
PUT categories/:id
| Name | Type | Description |
|---|---|---|
| authorization | String | User's unique authorization token |
| Name | Type | Description |
|---|---|---|
| ID | Number | Category's unique ID |
| category_name | String | Category's name |
| category_type | String | Either personal or relocation |
Success-Response:
HTTP 200 OK
[
{
"category_id": 1,
"category_name": "Car Payment",
"category_type": "Personal",
"user_id": null
},
{
"category_id": 2,
"category_name": "Car Insurance",
"category_type": "Personal",
"user_id": null
},
{
"category_id": 3,
"category_name": "Gas & Car Maintenance",
"category_type": "Personal",
"user_id": null
}
]
Error-Response
HTTP 400 MissingToken
{
"error": "No token provided. Please include a token in your authorization header."
}