Skip to content

get accounts id

Harmun edited this page May 15, 2019 · 2 revisions

get /accounts/:id User Return an account specified by id None { id, name, owner, deletedAt, lastUpdated, balance }

GET accounts/:id

Returns a single account specified by the id parameter. This will also calculate and return the account's balance.

See GET accounts for getting accounts in bulk.
Additionally see GET /accounts/?owner=[owner] to return accounts belonging to a specific owner.

Restrictions

  • Users can only access accounts belonging to them, unless they have the admin user role.
  • The id parameter must be numeric.
  • Does not retrieve deleted accounts.

Resource Information

Response formats JSON
Requires authentication? Yes

Example Request

curl -X GET \
  http://localhost:3000/accounts/2 \
  -H 'Authorization: Bearer 123testtoken' \
  -H 'Host: localhost:3000'

Example Response

A single account is returned as an object like this:

{
    "id": 2,
    "name": "infinityglove2",
    "owner": 2,
    "deletedAt": null,
    "lastUpdated": "2019-05-15T09:20:29.000Z",
    "balance": 600
}