Simple REST API to transfer money between accounts.
Run server with:
mvn clean install exec:java
Unit tests are available in src/test, integration tests are in it/test and should be executed with a server running on localhost:8080 without any previous data. To run unit tests:
mvn test
To run integration tests on API:
mvn test -Dtest=RestIT
Base URL is http://localhost:8080/api
Version: 1.0.0
License: MIT
Summary: Create a new account
Description:
Responses
| Code | Description |
|---|---|
| 201 | Created |
Summary: Get accounts
Description:
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Success | [ Account ] |
| 404 | Account not found |
Summary: Get account by its identifier
Description:
Parameters
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| id | path | Account unique identifier. | Yes | integer |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Success | Account |
| 404 | Account not found |
Summary: Create a new transaction for this account
Description:
Parameters
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| id | path | Account unique identifier. | Yes | integer |
| body | body | Transaction to create | Yes | Transaction |
Responses
| Code | Description |
|---|---|
| 201 | Created |
| 400 | Bad request, e.g. if you exceed the overdraft limit |
| 404 | Account not found |
Summary: Get transactions for this account
Description:
Parameters
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| id | path | Account unique identifier. | Yes | integer |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Success | [ Transaction ] |
| 404 | Account not found |
Summary: Get transaction by its identifier
Description:
Parameters
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| id | path | Account unique identifier. | Yes | integer |
| id2 | path | Transaction unique identifier. | Yes | integer |
Responses
| Code | Description | Schema |
|---|---|---|
| 200 | Success | Transaction |
| 404 | Account or transaction not found (transaction must be related to this account) |
| Name | Type | Description | Required |
|---|---|---|---|
| id | long | Account unique identifier. | Yes |
| balance | number | Account balance. | No |
| transactions | [ Transaction ] | Transactions list related to this account. | No |
| Name | Type | Description | Required |
|---|---|---|---|
| id | long | Transaction unique identifier. | Yes |
| amount | number | Amount transfered by this transaction. | Yes |
| type | string | Transaction type. | Yes |
| related | long | Related account unique identifier. | Yes |
| date | dateTime | Transaction date. | No |
API doc generated using swagger-markdown