Transaction - WHG-Students/Bankingsystem GitHub Wiki
Create Transaction
Make a transaction with your account.
Request Method
POST
Request Endpoint
https://students.trade/api/v1/transactions
Request body
In the request body, provide the following JSON keys with values.
| Key | Type | Description | Required |
|---|---|---|---|
| receiver_email | string | The receiver's email address | ✔ |
| amount | integer | The amount to be sent in cents | ✔ |
| title | string | The use for the transaction | ✖ |
Headers
| Name | Value |
|---|---|
| Authorization | Bearer <access_token> |
Example
Request
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbG..."
-X POST \
-d '{"sender_email":"[email protected]","receiver_email":"[email protected]", "amount": 5000, "title": "Payed for item foo"}' \
https://students.trade/api/v1/transactions
Response
Status Code 201
Content-Type application/json
{
"id": 111111111111,
"sender": "[email protected]",
"receiver": "[email protected]",
"amount": 5000,
"title": "Payed for item foo",
"createdOn": "2020-07-01T21:10:14.000Z"
}
Other possible responses
400Bad Request401Unauthorized404Not Found412Precondition Failed428Precondition Required500Internal Server Error
Get All Transactions
Get all past transactions about your account.
Request Method
GET
Request Endpoint
https://students.trade/api/v1/transactions
Headers
| Name | Value |
|---|---|
| Authorization | Bearer <access_token> |
Example
Request
curl -H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbG..."
-X GET \
https://students.trade/api/v1/transactions
Response
Status Code 200
Content-Type application/json
[
{
"id": 111111111111,
"sender": "[email protected]",
"receiver": "[email protected]",
"amount": 5000,
"name": "Payed for item foo",
"createdOn": "2020-07-01T21:10:14.000Z"
},
...
]
Other possible responses
401Unauthorized404Not Found412Precondition Failed428Precondition Required500Internal Server Error