Update Sector

Updates a sector with the given attributes.

PATCH /directory/v1/sectors/{id}

Path Parameters

id

string required

Id of the desired resource.

Request Body Parameters

You can see a breakdown of the different supported attributes for sectors here

Since JSON:API supports partial updates, every attribute of a sector can be updated individually or in small groups, without sending all the attributes of a resource on each request.

It is not possible to update the health-facility relationship.

Examples

Partial Update

curl -X PATCH "https://api.clinia.ca/directory/v1/sectors/${ID}" \
-H "Content-Type: application/vnd.api+json"
--data-binary '{
"data": {
"type": "sectors",
"relationships": {
"services": {
"data": [
{ "id": "9a2d0238-c5c3-411a-811b-848ded565276", "type": "services" }
]
}
}
}
}'
{
"data": {
"attributes": {
"created-at": "2020-10-16T20:35:08.9817111Z",
"updated-at": "2020-10-16T20:35:08.9817111Z",
"phones": [
{
"id": "phone-0fda3730-b761-4c93-bfda-3615ec43a08e",
"number": "15146262626",
"extension": "089",
"type": "MAIN"
}
],
"faxes": [
{
"id": "fax-3d65bd08-9f4f-4131-9091-47f841dd9768",
"number": "14324234277",
"type": "FAX"
}
],
"opening-hours": [
{
"day": 1,
"intervals": [{ "start": "00:00:00", "end": "00:00:00" }]
},
{
"day": 2,
"intervals": [{ "start": "08:00:00", "end": "17:00:00" }]
}
],
"note": "Accessible from the West side of the building.",
"internal-note": null
},
"relationships": {
"health-facility": {
"links": {
"self": "http://directory-jsonapi/v1/sectors/06da620a-3cc0-42c3-9a4b-bb1c6c764496/relationships/health-facility",
"related": "http://directory-jsonapi/v1/sectors/06da620a-3cc0-42c3-9a4b-bb1c6c764496/health-facility"
}
},
"services": {
"links": {
"self": "http://directory-jsonapi/v1/sectors/06da620a-3cc0-42c3-9a4b-bb1c6c764496/relationships/services",
"related": "http://directory-jsonapi/v1/sectors/06da620a-3cc0-42c3-9a4b-bb1c6c764496/services"
},
"data": [
{ "type": "services", "id": "9a2d0238-c5c3-411a-811b-848ded565276" }
]
}
},
"type": "sectors",
"id": "06da620a-3cc0-42c3-9a4b-bb1c6c764496"
}
}

Full Update

curl -X PATCH "https://api.clinia.ca/directory/v1/sectors/${ID}" \
-H "Content-Type: application/vnd.api+json"
--data-binary '{
"data": {
"type": "sectors",
"attributes": {
"faxes": [{ "number": "14324234277", "type": "FAX" }],
"phones": [
{ "number": "15146262626", "extension": "089", "type": "MAIN" }
],
"note": "Accessible from the West side of the building.",
"opening-hours": [
{ "day": 1, "intervals": [{ "start": "00:00:00", "end": "00:00:00" }] },
{ "day": 2, "intervals": [{ "start": "08:00:00", "end": "17:00:00" }] }
]
},
"relationships": {
"services": {
"data": [
{ "id": "9a2d0238-c5c3-411a-811b-848ded565276", "type": "services" }
]
}
}
}
}'
{
"data": {
"attributes": {
"created-at": "2020-10-16T20:35:08.9817111Z",
"updated-at": "2020-10-16T20:35:08.9817111Z",
"phones": [
{
"id": "phone-0fda3730-b761-4c93-bfda-3615ec43a08e",
"number": "15146262626",
"extension": "089",
"type": "MAIN"
}
],
"faxes": [
{
"id": "fax-3d65bd08-9f4f-4131-9091-47f841dd9768",
"number": "14324234277",
"type": "FAX"
}
],
"opening-hours": [
{
"day": 1,
"intervals": [{ "start": "00:00:00", "end": "00:00:00" }]
},
{
"day": 2,
"intervals": [{ "start": "08:00:00", "end": "17:00:00" }]
}
],
"note": "Accessible from the West side of the building.",
"internal-note": null
},
"relationships": {
"health-facility": {
"links": {
"self": "http://directory-jsonapi/v1/sectors/06da620a-3cc0-42c3-9a4b-bb1c6c764496/relationships/health-facility",
"related": "http://directory-jsonapi/v1/sectors/06da620a-3cc0-42c3-9a4b-bb1c6c764496/health-facility"
}
},
"services": {
"links": {
"self": "http://directory-jsonapi/v1/sectors/06da620a-3cc0-42c3-9a4b-bb1c6c764496/relationships/services",
"related": "http://directory-jsonapi/v1/sectors/06da620a-3cc0-42c3-9a4b-bb1c6c764496/services"
},
"data": [
{ "type": "services", "id": "9a2d0238-c5c3-411a-811b-848ded565276" }
]
}
},
"type": "sectors",
"id": "06da620a-3cc0-42c3-9a4b-bb1c6c764496"
}
}