Beginning the Budget App - Routes
My server implements a RESTful API to be used with the budget app, but in order to do that I need to decide on the routes I will need to access. This post outlines the initial routes I’ve decided to implement.
Deciding on routes
I started designing the endpoints of what I thought would be needed initially. I included this in my readme and copied the contents here:
General Endpoints
GET /
Response
{
"success": true,
"response": "Hello World Success!"
}
Auth Endpoints
POST /login
Body
{
"username": "user@email.com",
"password": "some_string"
}
Response
{
"success": true,
"response": "Authentication successful!",
"token": "eyJhbG--redacted--U"
}
POST /register
Body
{
"username": "user@email.com",
"password": "some_string"
}
Response
{
"success": true,
"response": "User created!"
}
Budget Endpoints
GET /api/budget/transactions/
Response
{
"success": true,
"transactions": [
{
"date": "date",
"amount": "decimal",
"notes": "string",
"cleared": "boolean",
"category_id": "integer",
"category_name": "string",
"account_id": "integer",
"account_name": "integer"
}
]
}
POST /api/budget/transaction/
Body
{
"transaction": {
"date": "date",
"amount": "decimal",
"notes": "string",
"cleared": "boolean",
"category_id": "integer",
"account_id": "integer",
"payee_id": "integer"
}
}
Response
{
"success": true,
"transaction_id": "integer"
}
GET /api/budget/accounts/
Response
{
"success": true,
"accounts": [
{
"account_id": "integer",
"account_name": "string",
"active": "boolean"
}
]
}
POST /api/budget/account/
Body
{
"account_name": "some_string"
}
Response
{
"success": true,
"account_id": "integer"
}
GET /api/budget/categories/
Response
{
"success": true,
"categories": [
{
"category_id": "integer",
"category_name": "string"
}
]
}
POST /api/budget/category/
Body
{
"category_name": "some_string"
}
Response
{
"success": true,
"category_id": "integer"
}