Skip to main content

Updating resources

Notation follows the APIs index.

  • HTTP verb MUST be PUT.
  • API path SHOULD follow the pattern /api/v1/{resource plural}/{id}.
  • Resources SHOULD carry updatedBy and revisionDate fields.

If the request's type is not that of the resource named in the path, or its id is not the one in the path, the API MUST return 422. This applies to partial updates too.

Example

PUT /api/v1/users/62bed180-1f78-45d4-8a56-c996936a2947
Accept: application/json
Content-Type: application/json
{
"data": {
"attributes": {
"email": "[email protected]",
"name": "Bob Smith"
},
"id": "62bed180-1f78-45d4-8a56-c996936a2947",
"type": "user"
}
}

Success responses

Upon success, APIs SHOULD return 200 - or 201 if the request created the resource - but MAY return 202 or 204.

StatusDescriptionResponse
200 OKThe resource was updated.The latest representation of the resource.
201 CreatedThe resource was created.The latest representation of the resource.
202 AcceptedThe resource is scheduled to be updated.The job that was scheduled to update the resource.
204 No ContentThe resource was updated.Nothing.

See also: Partial updates

Conflicting updates are detected with optimistic concurrency.