Partial Update Resource
Partially pdate a Resource or a Contained Resource based on the request's operations. You can pass any first-level properties you want to add, replace or delete, but you can't individually update attributes of properties.
PATCH /v1/:type/:id
Path Parameters
type
- (required, string) specifies the type of the resource. Possible values are described in Resource Types.id
- (required, string) specifies the id of the resource. A resource can be fetched either byid
or by any of its identifiers.
Request Body
The request body is a json array that contains contains a set of operations.
Operations
Add
Adds a value to a Resource or inserts it into an array.
// Single
{
"op": "add",
"path": "name",
"value": "Name of the resources"
}
// Array
{
"op": "add",
"path": "phone/1",
"value": {
"value": "4444444",
"use": "main",
"system": "phone",
"extension": null
}
}
Remove
Removes a value from an object or array.
{
"op": "remove",
"path": "name"
}
Replace
Replaces a value. Equivalent to a “remove” followed by an “add”.
// Single
{
"op": "replace",
"path": "name",
"value": "New Name of the resources"
}
// Array
{
"op": "replace",
"path": "phone/1",
"value": {
"value": "4444444",
"use": "main",
"system": "phone",
"extension": null
}
}
Example
Example of request body to replace the name of a resource
PATCH /v1/clinic/cd429379-821e-42e1-8d4c-815349534670
[
{
"op": "replace",
"path": "name",
"value": "New Name of the resources"
}
]
Response
Returns 200 - OK
with a Resource of the targeted type in the response body.
Example
200 OK on PATCH /v1/clinic/cd429379-821e-42e1-8d4c-815349534670
{
"id": "cd429379-821e-42e1-8d4c-815349534670",
"createdAt": "2021-10-12T18:24:09.651074Z",
"updatedAt": "2021-10-12T18:24:09.651074Z",
"name": "New Name of the resources",
"phone": [
{
"id": "phone-d13f82fa-2fd5-4422-8e29-dd4fec650440",
"value": "5140902999",
"use": "reception",
"system": "phone",
"extension": null
}
],
"email": [
{
"id": "email-35bfdca3-3e63-49e3-97b4-18979da37a0c",
"value": "info@footclinic.com",
"use": "info",
"system": "email"
}
],
"openingHours": [
{
"day": 1,
"start": "08:00:00",
"end": "17:00:00"
},
{
"day": 2,
"start": "08:00:00",
"end": "17:00:00"
},
{
"day": 3,
"start": "08:00:00",
"end": "17:00:00"
},
{
"day": 4,
"start": "08:00:00",
"end": "17:00:00"
},
{
"day": 5,
"start": "08:00:00",
"end": "17:00:00"
}
]
}