A simple RESTful API Family Cash Card application — a modern way for parents to manage allowance funds for their kiddos.
Java, Spring (Boot, Data, Security), TDD, H2
Request
URI: /cashcards/{id}
HTTP Verb: GET
Body: None
Response
HTTP Status:
200 OK if the user is authorized and the Cash Card was successfully retrieved
403 UNAUTHORIZED if the user is unauthenticated or unauthorized
404 NOT FOUND if the user is authenticated and authorized but the Cash Card cannot be found
Response Body Type: JSON
Example Response Body:
{
"id": 99,
"amount": 123.45
}
| Operation | API Endpoint | HTTP Method | Response Status |
|---|---|---|---|
| Create | /cashcards |
POST |
201 (CREATED) |
| Read | /cashcards/{id} |
GET |
200 (OK) |
| Update | /cashcards/{id} |
PUT |
204 (NO DATA) |
| Delete | /cashcards/{id} |
DELETE |
204 (NO DATA) |
Request:
-
Method: POST
-
URI:
/cashcards/ -
Body:
{ "amount": 123.45 }
Response:
- Status Code: 201 CREATED
- Header:
Location=/cashcards/42
Read one
Request:
- Method: GET
- URI:
/cashcards/99 - Body: (empty)
Response:
- Status Code: 200 OK
- Body:
{
"id": 99,
"amount": 123.45
}Read all
Request:
- Method: GET
- URI:
/cashcards - Body: (empty)
Response:
- Status Code: 200 OK
- Body:
[
{
"id": 1,
"amount": 123.45
},
{
"id": 2,
"amount": 50.0
}
]Request:
- Method: PUT
- URI:
/cashcards/42 - Body:
{
"amount": 19.99
}Response:
- Status Code: 204 NO CONTENT
Request:
- Method: DELETE
- URI:
/cashcards/42 - Body: (empty)
Response:
- Status Code: 204 NO CONTENT