Update Sector's Services

Updates a sector's services.

PATCH /directory/v1/sectors/{id}/relationships/services

Path Parameters

id

string required

Id of the desired resource.

Request Body Parameters

Data

Array<Relationship>

Services to assign to this sector.

{
"data": [
{ "type": "services", "id": "7907886b-6a98-4992-8978-93cd173ed357" },
{ "type": "services", "id": "82c2deed-18b9-4a9d-8b0b-0374ddc02dd9" }
]
}
important

For sectors associated with health facilities of type hospital, one should always associate sectors with only 1 top level service. This sector/service combination is used to determine what are the different departments of a hospital. Many sub-services of the top level service can be added to each sector without problem.

important

When assigning a service, one should make sure to assign all of the service's ancestors as well. This will allow users to get better results when searching for services in the same family as the ones assigned to the resource. Ancestors are returned with each service upon fetching.

Example of the optimal definition of a resource :

{
"data": {
"type": "sectors",
"id": "1d6319c1-8510-4803-bbfc-52e5c1303845",
"relationships": {
...
"services": {
"data": [
{ "type": "services", "id": "4ed05f0a-6ef0-47c4-8a96-b8e49c5fad5d" }, // Acupuncture top level service
{ "type": "services", "id": "bb80b982-7aea-4d55-a60a-d9435a3f1c1d" }, // Digestive system acupuncture sub-service
{ "type": "services", "id": "3cd175bf-d1b0-43c8-bcfa-a66d6995909e" } // Acupuncture treatment sub-service
]
},
}
}
}
important

Services sent in an update request will overwrite any existing services, so make sure to send all services to associate on each update request.

Examples

Update Services

curl -X PATCH "https://api.clinia.ca/directory/v1/sectors/${ID}/relationships/services" \
-H "Content-Type: application/vnd.api+json"
--data-binary '{
"data": [
{ "id": "7907886b-6a98-4992-8978-93cd173ed357", "type": "services" },
{ "id": "6b6bc664-d799-4022-a0b1-a58d55263432", "type": "services" }
]
}'
{
"data": {
"attributes": {
"created-at": "2020-10-29T15:55:50.8735128Z",
"updated-at": "2020-10-29T15:55:50.8735128Z",
"phones": [
{
"id": "phone-c61ef667-25e0-4c10-90fa-f730ac1d846d",
"number": "12222222222",
"type": "MAIN"
}
],
"faxes": null,
"opening-hours": null,
"note": null,
"internal-note": null
},
"relationships": {
"health-facility": {
"type": "health-facilities",
"id": "4401d4c0-61bc-4f59-b31b-ed9b28e2a6bd"
},
"services": {
"data": [
{
"type": "services",
"id": "7907886b-6a98-4992-8978-93cd173ed357"
},
{ "type": "services", "id": "6b6bc664-d799-4022-a0b1-a58d55263432" }
]
}
},
"type": "sectors",
"id": "5f0d8b46-0676-4d58-824d-2afbe07155ed"
},
"included": [
{
"attributes": {
"name": "test",
"type": "hospital",
"tags": null,
"address": {
"street-number": "14",
"route": "York Street",
"postal-code": "M5J 0B1",
"locality": "Old Toronto",
"district": "Toronto Division",
"place": "Toronto",
"region": "Ontario",
"region-code": "ON",
"country": "Canada",
"country-code": "CA"
},
"location": { "lat": 43.6417374, "lng": -79.3822536 },
"phones": [
{
"id": "phone-91ecc230-a3ef-4386-ba97-cf45a8f94dbd",
"number": "12222222222",
"type": "MAIN"
},
{
"id": "phone-8e2301c2-1d5a-4659-b2fd-b73da3ee7a74",
"number": "12222222222",
"type": "MAIN"
},
{
"id": "phone-0cd738b4-3156-471b-aacb-cdd8c1bb3eb8",
"number": "12222222222",
"type": "MAIN"
}
],
"faxes": null,
"emails": null,
"online-bookings": null,
"opening-hours": null,
"supported-languages": ["CANTONESE"],
"socials": null,
"note": null,
"internal-note": null,
"created-at": "2020-10-29T15:55:50.0853655Z",
"updated-at": "2020-10-29T15:56:11.1537567Z"
},
"relationships": {
"walk-in": {},
"sectors": {
"data": [
{ "type": "sectors", "id": "dc06a06d-2604-4bac-bc36-a3545969a81d" },
{ "type": "sectors", "id": "5f0d8b46-0676-4d58-824d-2afbe07155ed" },
{ "type": "sectors", "id": "ef91e431-d4d4-483d-9530-d7a61f8b4ed4" }
]
},
"practices": {},
"services": {}
},
"type": "health-facilities",
"id": "4401d4c0-61bc-4f59-b31b-ed9b28e2a6bd"
},
{
"attributes": {
"created-at": null,
"updated-at": null,
"names": { "en": "Addiction", "fr": "Dépendance" }
},
"relationships": {
"parent": {},
"children": {
"data": [
{ "type": "services", "id": "6b6bc664-d799-4022-a0b1-a58d55263432" }
]
}
},
"type": "services",
"id": "7907886b-6a98-4992-8978-93cd173ed357"
},
{
"attributes": {
"created-at": null,
"updated-at": null,
"names": {
"en": "Opioid addiction consultation",
"fr": "Consultation pour dépendances aux opioïdes"
}
},
"relationships": {
"parent": {
"data": {
"type": "services",
"id": "7907886b-6a98-4992-8978-93cd173ed357"
}
},
"children": { "data": [] }
},
"type": "services",
"id": "6b6bc664-d799-4022-a0b1-a58d55263432"
}
]
}