Skip to main content

Update

Update Resource

This entrypoint updates a target resource.

  • PATCH /{base_url}/:id

Parameters

NameTypeInDescriptionDefault
idstringparamResource identifier; required
returning_allbooleanqueryWhether to return entire document or partial documenttrue

Example

request

curl \
-X PATCH \
-H "Accept: application/json" \
https://example.com/users/5d6ede6a0ba62570afcedd3b?returning_all=false \
-d '{ "name": "Andrew-2nd" }'

response

Status: 200
{
"name": "Andrew-2nd"
}

Update Resource - Advanced

This entrypoint updates a target resource and returns selective data fields.

  • PATCH /{base_url}/__mutation/:id

Parameters

NameTypeInDescriptionDefault
idstringparamResource identifier; required
returning_allbooleanqueryWhether to return entire document or partial document; 2ndtrue
dataobjectbodyDocument data to create
selectobject │ array[string]bodyDocument fields to include or exclude after the update
populatearray[string] │ array[object]bodyDocument fields to populate after the update
options.returningAllbooleanbodyWhether to return entire document or partial document; 1sttrue
options.includePermissionsbooleanbodyWhether to include document permissionstrue
options.populateAccess'list' │ 'read'bodyThe access level to use in populate methodread

Example

request

curl \
-X PATCH \
-H "Accept: application/json" \
https://example.com/users/5d6ede6a0ba62570afcedd3b \
-d '{
"data": { "name": "Andrew-2nd" },
"select": ["name", "address"],
"populate": ["address"],
"options": {
"includePermissions": true,
"populateAccess": "read",
}
}'

response

Status: 200
{
"_id": "5d6ede6a0ba62570afcedd3b",
"name": "Andrew-2nd",
"address": {
"city": "Seattle",
"country": "USA"
},
"_permissions": {
"edit": false
}
}