Skip to content

put accounts id

Harmun edited this page May 16, 2019 · 3 revisions

put /accounts/:id Admin/User Update an account specified by id { name } { id, name, owner, deletedAt, lastUpdated, balance }

PUT accounts/:id

Update an account specified by id.

Restrictions

  • Users can only manipulate accounts tied to their own ID, unless they have the admin user role.
  • The id parameter must be numeric.
  • Currently only the name field is supported.

Resource Information

Request formats JSON
Requires authentication? Yes
name string

Fields

Name Required Description Role Example
name required The account's new name user "mySavingsAccount"

Example Request

curl -X PUT \
  http://localhost:3000/accounts/2 \
  -H 'Authorization: Bearer 123testtoken123' \
  -H 'Content-Type: application/json' \
  -H 'Host: localhost:3000' \
  -d '{
	"name" : "completeInfinityGlove"
}'

Example Response

The updated account is returned as an object like this:

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