Update Health Facility's Services

Updates a health facility's services.

PATCH /directory/v1/health-facilities/{id}/relationships/services

Path Parameters

id

string required

Id of the desired resource.

Request Body Parameters

Data

Array<Relationship>

Services to assign to this health-facility.

{
"data": [
{ "type": "services", "id": "7907886b-6a98-4992-8978-93cd173ed357" },
{ "type": "services", "id": "82c2deed-18b9-4a9d-8b0b-0374ddc02dd9" }
]
}
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": "clinics",
"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/health-facilities/${ID}/relationships/services" \
-H "Content-Type: application/vnd.api+json"
--data-binary '{
"data": [
{ "type": "services", "id": "7907886b-6a98-4992-8978-93cd173ed357" },
{ "type": "services", "id": "82c2deed-18b9-4a9d-8b0b-0374ddc02dd9" },
{ "type": "services", "id": "224820f5-c16c-489a-b9c9-9aee8dc164d9" },
{ "type": "services", "id": "b714db12-3e17-47e1-a840-4e3dabe20627" },
{ "type": "services", "id": "070d7b80-c5a2-4d32-b118-2e3e159b0a32" },
{ "type": "services", "id": "0910ede3-18f7-4d8f-834b-82f35909c319" }
]
}'
{
"data": {
"attributes": {
"name": "Clinic test",
"type": "clinic",
"tags": null,
"address": {
"street-number": "121",
"route": "McMahon Drive",
"postal-code": "M2K 1C2",
"locality": "North York",
"district": "Toronto Division",
"place": "Toronto",
"region": "Ontario",
"region-code": "ON",
"country": "Canada",
"country-code": "CA"
},
"location": { "lat": 43.7674479, "lng": -79.3712294 },
"phones": [
{
"id": "phone-6eb17d4f-e486-485f-98c5-2be7bc1d0b99",
"number": "11111111111",
"type": "MAIN"
},
{
"id": "phone-01573fe6-0da3-4907-a460-3e2167d44322",
"number": "12222222222",
"type": "INFO"
},
{
"id": "phone-a309abfb-d182-4aaa-90f7-2bb87f98c293",
"number": "13333333333",
"type": "ALTERNATE"
}
],
"faxes": [
{
"id": "fax-537a21ad-603e-436f-b787-af942adfbccc",
"number": "14444444444",
"type": "FAX"
}
],
"emails": [
{
"id": "email-23d77801-233c-4121-8e51-8f40c8b1c6b7",
"address": "test@clinia.ca"
}
],
"online-bookings": [
{
"id": "online_booking-fe6f8a8c-9f4f-4cb9-9243-df94abda7ebd",
"url": "http://clinia.com/fr"
}
],
"opening-hours": [
{ "day": 1, "intervals": [{ "start": "09:00:00", "end": "13:00:00" }] },
{
"day": 4,
"intervals": [
{ "start": "09:00:00", "end": "12:00:00" },
{ "start": "13:00:00", "end": "14:00:00" }
]
}
],
"supported-languages": ["BENGALI", "ENGLISH", "HINDI"],
"socials": [
{
"id": "social-749ad091-4fe7-4778-b206-aae5a9de1f02",
"url": "http://clinia.ca"
}
],
"note": "Public Note",
"internal-note": "Private Note",
"created-at": "2020-10-29T15:45:54.6065246Z",
"updated-at": "2020-11-03T21:46:52.661217Z"
},
"relationships": {
"walk-in": {},
"sectors": {},
"practices": {},
"services": {
"data": [
{ "type": "services", "id": "82c2deed-18b9-4a9d-8b0b-0374ddc02dd9" },
{ "type": "services", "id": "224820f5-c16c-489a-b9c9-9aee8dc164d9" },
{ "type": "services", "id": "b714db12-3e17-47e1-a840-4e3dabe20627" },
{ "type": "services", "id": "7907886b-6a98-4992-8978-93cd173ed357" },
{ "type": "services", "id": "070d7b80-c5a2-4d32-b118-2e3e159b0a32" },
{ "type": "services", "id": "0910ede3-18f7-4d8f-834b-82f35909c319" }
]
}
},
"type": "health-facilities",
"id": "26847c49-1542-4d73-8aaf-0ba4a362e7a2"
}
}