-
Notifications
You must be signed in to change notification settings - Fork 7
get transactions account
Harmun edited this page May 17, 2019
·
2 revisions
get | /transactions/?account=[account] | Admin/User | Return all transactions associated with specified account as an array of objects | None | [ { id, debitAccountId, creditAccountId, amount, date }, ... ] |
Returns all transactions associated with the account specified in the parameter.
See get accounts for getting all transactions in bulk.
Additionally see get accounts/:id to return a specific account by id.
- Users can only access accounts belonging to them, unless they have the admin user role.
- The account parameter must be numeric.
- Does not retrieve deleted accounts.
- Balance in accounts are not calculated.
Response formats | JSON |
Requires authentication? | Yes |
account | integer |
Name | Required | Description | Role | Example |
---|---|---|---|---|
account | required | The account's id | user | 2 |
A request to look for all transactions tied to account 2
would look like:
curl -X GET \
'http://localhost:3000/transactions/?account=2' \
-H 'Authorization: Bearer 123testtoken123' \
-H 'Host: localhost:3000'
Transactions for account 2
are returned as an array of objects like this:
[
{
"id": 1,
"debitAccountId": 1,
"creditAccountId": 2,
"amount": 100,
"date": "2019-05-16T14:55:01.000Z"
},
{
"id": 6,
"debitAccountId": 2,
"creditAccountId": 3,
"amount": 300,
"date": "2019-05-16T14:55:01.000Z"
},
{
"id": 10,
"debitAccountId": 6,
"creditAccountId": 2,
"amount": 700,
"date": "2019-05-16T14:55:01.000Z"
},
{
"id": 11,
"debitAccountId": 2,
"creditAccountId": 3,
"amount": 1000,
"date": "2019-05-16T15:15:49.000Z"
},
{
"id": 12,
"debitAccountId": 2,
"creditAccountId": 3,
"amount": 90,
"date": "2019-05-16T15:16:31.000Z"
}
]