Skip to main content

Patch Document

deprecated

The

PATCH
method for the Documents endpoint has been deprecated due to instability with script operations. We may re-active this method after consultation on requirements.

workaround

The recommended workaround is to modify the document locally then:

  • POST
    the modified document to the API using the document _id in the URL. See Post Document.
  • PUT
    the modified document to the API with a filter applied in the request body. See Put Document.

Click here to show historic documentation

info

All JSON array responses have been shortened for readability.

PATCH/<ApplicationID/collections/<CollectionID>/documents/<DocumentID>
Endpoint Requires Authentication
Example
https://api.weightron.cloud/641c1177ebc8b2f3c195b02c/collections/641c1177ebc8b2f3c195b033/documents
Request Body
{
"filter": {
"name": {
"$eq": "Area 5"
}
},
"update": {
"name": "Area 6",
"block": false,
"_hash": "4f189f73cc42d5f21afb19a1125f2f94edadec3e"
}
}
Description

Updates a document in the database with the given partial. The returned object is the object now in the database, after all calculations are finished.

Will only update one record per request. The request body must contain the filter and update properties.

Returns
{
"timestamp": "2023-03-23T16:17:55.808Z",
"data": {
"_id": "641c75a18fde9d1d8a0e247e",
"name": "Area 6",
"block": false,
"_hash": "044a826af522d8c008f3737f18e442a2723a1513",
"_updatedAt": "2023-03-23T16:17:55.730Z",
"_changedBy": "641c11c7ebc8b2f3c195b098"
}
}