UPDATE: Updates a document in the collection
Normally the document with the matching identifier will be replaced in the collection by the whole JSON request body and 200 HTTP status code will be returned.
If the document has been found in the collection but it had already been deleted, 410 HTTP status code is to be returned.
When no document with identifier has been found in the collection, then an insert operation takes place instead of updating. Finally 201 HTTP status code is returned with only Last-Modified header (identifier is already known from the path parameter).
You can also specify If-Unmodified-Since request header including your timestamp of document's last modification. If the document has been modified by somebody else on the server afterwards (and you do not know about it), the 412 HTTP status code is returned cancelling the update operation. You can use this feature to prevent race condition problems.
This operation provides autopruning of the collection (if autopruning is enabled).
This operation requires update (and/or create) permission for the API and the collection (e.g. api:treatments:update and api:treatments:create)
Headers
Timestamp (defined with respect to server's clock) of the last document modification formatted as:
<day-name>, <day> <month> <year> <hour>:<minute>:<second> GMT
If this header is present, the operation will compare its value with the srvModified timestamp of the document at first and the operation result then may differ. The srvModified timestamp was defined by server's clock.
Example:
<pre>If-Unmodified-Since: Wed, 17 Oct 2018 05:13:00 GMT</pre>Request body
Example request
{
"identifier": "53409478-105f-11e9-ab14-d663bd873d93",
"date": 1525383610088,
"utcOffset": 120,
"app": "xdrip",
"device": "dexcom G5",
"_id": "58e9dfbc166d88cc18683aac",
"srvCreated": 1525383610088,
"subject": "uploader",
"srvModified": 1525383610088,
"modifiedBy": "admin",
"isReadOnly": true
}Response
The request was successfully processed
Example response
{
"status": 200
}Changes
Changed in 4 of the 6 revisions of this API.9627
- ○
the endpoint scheme security
accessTokenwas removed from the APIapi-security-removed
This revision also has 1 change that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ○
- ▲
removed the success response with the status
204response-success-status-removed
- ○
the endpoint scheme security
accessTokenwas added to the APIapi-security-added
- ○
the endpoint scheme security
jwtokenwas added to the APIapi-security-added
- ○
the endpoint scheme security
apiKeyAuthwas removed from the APIapi-security-removed
- ○
added the media type
application/jsonfor the response with the status201response-media-type-added
- ○
added the media type
application/jsonfor the response with the status400response-media-type-added
- ○
added the media type
application/jsonfor the response with the status401response-media-type-added
- ○
added the media type
application/jsonfor the response with the status403response-media-type-added
- ○
added the media type
application/jsonfor the response with the status404response-media-type-added
- ○
added the media type
application/jsonfor the response with the status410response-media-type-added
- ○
added the media type
application/jsonfor the response with the status412response-media-type-added
- ○
added the media type
application/jsonfor the response with the status422response-media-type-added
- ○
added the success response with the status
200response-success-status-added
- ▲
- ○
added the new optional request property
oneOf[DeviceStatus]/allOf[DocumentBase]/isReadOnlynew-optional-request-property
- ○
added the new optional request property
oneOf[Entry]/allOf[DocumentBase]/isReadOnlynew-optional-request-property
- ○
added the new optional request property
oneOf[Food]/allOf[DocumentBase]/isReadOnlynew-optional-request-property
- ○
added the new optional request property
oneOf[Profile]/allOf[DocumentBase]/isReadOnlynew-optional-request-property
- ○
added the new optional request property
oneOf[Settings]/allOf[DocumentBase]/isReadOnlynew-optional-request-property
- ○
added the new optional request property
oneOf[Treatment]/allOf[DocumentBase]/isReadOnlynew-optional-request-property
- ○
added the non-success response with the status
422response-non-success-status-added
- ○
- ▲
removed the media type
application/jsonfor the response with the status201response-media-type-removed
- ▲
removed the media type
application/jsonfor the response with the status400response-media-type-removed
- ▲
removed the media type
application/jsonfor the response with the status401response-media-type-removed
- ▲
removed the media type
application/jsonfor the response with the status403response-media-type-removed
- ▲
removed the media type
application/jsonfor the response with the status404response-media-type-removed
- ▲
removed the media type
application/jsonfor the response with the status410response-media-type-removed
- ▲
removed the media type
application/jsonfor the response with the status412response-media-type-removed
- ▲
removed the success response with the status
200response-success-status-removed
- ●
removed the request property
oneOf[DeviceStatus]/allOf[DocumentBase]/isReadOnlyrequest-property-removed
- ●
removed the request property
oneOf[Entry]/allOf[DocumentBase]/isReadOnlyrequest-property-removed
- ●
removed the request property
oneOf[Food]/allOf[DocumentBase]/isReadOnlyrequest-property-removed
- ●
removed the request property
oneOf[Profile]/allOf[DocumentBase]/isReadOnlyrequest-property-removed
- ●
removed the request property
oneOf[Settings]/allOf[DocumentBase]/isReadOnlyrequest-property-removed
- ●
removed the request property
oneOf[Treatment]/allOf[DocumentBase]/isReadOnlyrequest-property-removed
- ○
the endpoint scheme security
apiKeyAuthwas added to the APIapi-security-added
- ○
the endpoint scheme security
jwtokenwas removed from the APIapi-security-removed
- ○
added the new optional
headerrequest parameterDateto all path's operationsnew-optional-request-default-parameter-to-existing-path
- ○
added the new optional
queryrequest parameternowto all path's operationsnew-optional-request-default-parameter-to-existing-path
- ○
added the new optional
queryrequest parametertokento all path's operationsnew-optional-request-default-parameter-to-existing-path
- ○
removed the non-success response with the status
422response-non-success-status-removed
- ○
added the success response with the status
204response-success-status-added
This revision also has 8 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ▲