-
Notifications
You must be signed in to change notification settings - Fork 7
Accounts
Harmun edited this page May 15, 2019
·
1 revision
The following endpoints can be used to create, update & soft-delete users. Note that users can only affect their own data, not those of other users.
Method | Path | Token Type | Description | Expected Body Input | Expected Output |
---|---|---|---|---|---|
post | /accounts | User | Add new account to db | { name, owner } | { id, name, owner, deletedAt, lastUpdated, balance } |
get | /accounts/?owner=[owner] | User | Return all accounts associated with specified owner as an array of objects | None | [ { id, name, owner, deletedAt, lastUpdated }, ... ] |
get | /accounts/:id | User | Return an account specified by id | None | { id, name, owner, deletedAt, lastUpdated, balance } |
put | /accounts/:id | User | Update an account specified by id | { name } | { id, name, owner, deletedAt, lastUpdated, balance } |
delete | /accounts/:id | User | Soft delete an account specified by id | None | { id, name, owner, deletedAt, lastUpdated, balance } |
Admins have additional functionality or unique endpoints available to them.
Method | Path | Token Type | Description | Expected Body Input | Expected Output |
---|---|---|---|---|---|
post | /accounts | Admin/User | Add new account to db | { name, owner } | { id, name, owner, deletedAt, lastUpdated, balance } |
get | /accounts | Admin | Return all accounts as an array of objects | None | [ { id, name, owner, deletedAt, lastUpdated }, ... ] |
get | /accounts/?owner=[owner] | Admin/User | Return all accounts associated with specified owner as an array of objects | None | [ { id, name, owner, deletedAt, lastUpdated }, ... ] |
get | /accounts/:id | Admin/User | Return an account specified by id | None | { id, name, owner, deletedAt, lastUpdated, balance } |
put | /accounts/:id | Admin/User | Update an account specified by id | { name } | { id, name, owner, deletedAt, lastUpdated, balance } |
delete | /accounts/:id | Admin/User | Soft delete an account specified by id | None | { id, name, owner, deletedAt, lastUpdated, balance } |