The LocatorAPI currently has three endpoints. The locator API can currently support querying:
Locators or OrgUnits near by
List of Areas in a country
List of subAreas within the country and the area
Locators near me
This endpoint provides list of organization units around the provided coordinates.
url : api/v1/locator
method: POST
authorization: will be provided by admin
payload:
This endpoint retrieves a list of organization units in proximity to the provided geographic coordinates.
URL : api/v2/locator
Method:
Status | ||||
---|---|---|---|---|
|
Status | ||||
---|---|---|---|---|
|
Authorization: Managed via Spring Framework Security (See: Link)
Info |
---|
Note: For PSI implementation, authorization is handled by OpenHIM, and Spring Boot security is disabled by default. |
Request Parameters
Required Parameters
You must provide at least one of the following parameters
Parameter | dhis2 Attribute | Description | Example | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
coordinates | (String) Format: "latitude,longitude" | coordinates=-0.1663,35.5924 | |||||||||
points | (Array of Decimals)
|
| |||||||||
latitude | (Decimal) | latitude=-26.18 | |||||||||
longitude | (Decimal) | longitude=28.31 | |||||||||
| |||||||||||
Organization Unit | |||||||||||
uid |
| (String) Unique identifier (UID) generated by DHIS2 for an organization unit. | |||||||||
code |
| (String) Code assigned to the organization unit. | |||||||||
shortName |
| (String) Short name of the organization unit. | |||||||||
Ancestor (Organization Unit) | |||||||||||
ancestor.uid |
| (String) OrgUnit UID / code for ancestor. When provided, all locators/facilities under it are populated. Represents the DHIS2 parent that represents the country. | |||||||||
ancestor.code |
|
Info |
---|
Please Note
|
Optional parameters
Parameter | Option Value | Default Option | Description |
---|---|---|---|
paging | Boolean | true | Specifies whether pagination is required. |
page | Number | 1 | Determines the page number to be returned. |
pageSize | Number | 10 | Sets the total number of items per page. |
distance | Number | 10 | Specifies the radius (in unit specified) within which to generate the organization units. |
unit | Options: | km | Defines the unit of measurement for distance. |
level | Number | 7 | Indicates the hierarchy level of the organization unit. |
Filters
type | Text | Specifies the type of the location. | |
---|---|---|---|
phoneNumber | Text (Phone Number) | N/A | DHIS2 core element that defines the phone number of the location. |
tags | Text (Separated by ',' or '|') | N/A | Defines the tags the locations are associated with. |
Text | NA | Returns all the organization which has all of the tags provided. | |
services | Text (Separated by ',' or '|') | N/A | Defines the services offered by the locations. Returns all the organization which has at least one of the service provided. |
Text | Returns all the organization which has all of the services provided. | ||
area | Text | N/A | Defines the broader area where the location is situated. |
subArea | Text | N/A | Specifies the subarea of the location. |
Text (phone Number) | N/A | Indicates the WhatsApp number of the location. | |
Text or URL | N/A | Provides the Facebook URL for the location. | |
responseFhir | Boolean | No | Determines if the response should be in FHIR or DHIS2 format. |
URL (for
Status | ||||
---|---|---|---|---|
|
https://{{host}}/api/v2/locator?paging=false&coordinates=lat,lng&distance=5&unit=km
Payload (for
Status | ||||
---|---|---|---|---|
|
Code Block | ||
---|---|---|
| ||
{ "numberpaging": 10true, "distancepage": 51, "unitpageSize": 10, "km",ancestor": { "coordinatesid": "lat,lnga23acb2452xyz", "isocode": "KE" }, "servicesorganisationunit": "service1,service2{ "id", "q13we2452wsd", "uidshortName": 'q13we2452wsd' "Sub Hospital" }, "codecoordinates": lat,lng, "CODE-123"points": [lat,lng], "contraceptiondistance": "iud5,imp", "tagsunit": "km"tag1,tag2" "level": 7, "typephoneNumber": "Public180999093107", "area": "Managua", "subArea": "Ciudad Sandino", "type": "phonenumber"Public", "tags": "tag1,tag2", "services": "180999093107service1,service2", "wapwhatsapp": "977984123145", "facebook": "https://fb.me/facility1" } |
response:
Code Block | ||
---|---|---|
| ||
{, "returnCodelatitude": "200"lat, "outletlongitude": [lon, "responseFhir": false } |
Response (In DHIS2):
Code Block | ||
---|---|---|
| ||
{ "pager": {...} "dhisCodeorganisationUnits": "KE-CODE-123",[ { "dhisId": "xkcEJARvo2O", "servicesStandardid": "CCS,CNT,ANC,STI,HVS,HVTxkcEJARvo2O", "outletTypeparentId": "Public15561086", "ouShowContactInfocode": "TLFKE-CODE-123", "pathname": "Facility Clinic (KE-CODE-123)", "outletNameshortName": "Facility Clinic", "phoneNumberdescription": "+254541483334"null, "postgresIdopeningDate": "15113458702023-02-11", "locatorTypeclosedDate": "OUT"null, "locationcomment": { null, "areaurl": "Nairobi"null, "areaSubcontactPerson": "Starehe", null, "address": "street1, city, subarea, area", "latitudeemail": "-1mymail@gmail.28575com", "longitudephoneNumber": "39.81234" }+254541483334", "dhisNamepath": "Facility Clinic (KE-CODE-123)", "openingHourslevel": "Mon-Fri,8:00,17:00;Sat,9:00,14:00;Public Holiday,9:00,14:00;Sun,Closed7", "openingDatearea": "2023-02-11Nairobi", "ouTagssubArea": "MSIStarehe", "providerslatitude": []"-1.28575", "ouContraceptiveslongitude": "IMP,OCP,IUD,INJ,STL,EMC""39.81234", } ] } |
Areas in the country
Provides list of areas in the country.
url : api/v1/area
method: POST
authorization: will be provided by admin
payload:
Code Block | ||
---|---|---|
| ||
{ "country": "KE", "pageNo": 1"geometry": "{\"type\":\"Point\",\"coordinates\":[39.81234,-1.28575]}", "pageSize": 5, "facilityType": "Public", "tagsdistance": "KEUNV" } |
response:
Code Block | ||
---|---|---|
| ||
{0.0, "response": { "returnCodeopeningHours": "200", "totaNosofPages": 10, "areas": [Mon-Fri,8:00,17:00;Sat,9:00,14:00;Public Holiday,9:00,14:00;Sun,Closed", { "area"services": "BaringoCCS,CNT,ANC,STI,HVS,HVT", "countrylocationType": "Kenya" }OUT", { "area"type": "BometPublic", "countrytags": "Kenya" }KEUNV", { "fb": null, "areawhatsapp": "Bungoma", null, "countryshowContactInfo": "KenyaTLF" }, ] } |
Note: The attributes sequence might be different from the sequence listed above.
Response (in FHIR):
Code Block | ||
---|---|---|
| ||
{ "pager": { "page": 1, "pageCount": 1, "areatotal": "Busia"1, "pageSize": 1, "first": true, "countrylast": "Kenya" true }, "locations": [ { "arearesourceType": "Elgeyo MarakwetLocation", "countryid": "Kenyad5AeP1W7nT", }"identifier": [ ], "links":{ [ { "rel"system": "selfhttp://www.acme.org/identifiers/location", "hrefvalue": "/locator-dev/api/area?1=1&country=KE&pageNo=1&pageSize=5US-FH-1235" }, }, { { "rel": "next", "hrefsystem": "/locator-dev/api/area?1=1&country=KE&pageNo=2&pageSize=5"http://www.acme.org/identifiers/location", } ], "totalNosOfRecords"value": 48, "currentPageNo": "1","/s7JFm0K2cN/8xqYb6V3gL/i4hDz9R1mE/a2XpM3G6rC/c9NlB7P8jY/u3RcT5L9vH/d5AeP1W7nT" "status": "Showing 5 Areas" } } |
SubAreas in the country
Provides list of areas in the country.
url : api/v1/subArea
method: POST
authorization: will be provided by admin
payload:
Code Block |
---|
{ "country": "GT", "area": "Guatemala", "pageNo": 1, ], "pageSize": 5, "facilityTypename": "Public",Riverside General "tags": "KEUNV" } |
response:
Code Block |
---|
{ Hospital (US-FH-1235)", "response": { "returnCodealias": "200",[ "totaNosofPages": 10, "Riverside General "subAreasHospital": [ { ], "subAreadescription": "Amatitlán", null, "areastatus": "Guatemalaactive", "countrymode": "GTinstance", }, "address": { "subAreastreet1": "Antigua123 Main GuatemalaStreet", "areastreet2": "Guatemala"null, "countrycity": "GT" }Any City", { "subArea"state": "FraijanesNY", "areapostalCode": "Guatemala"12345, "country": "GTUnited State" }, { "subArea"contact": "Guatemala{ Zona 1", "areatelecom": "Guatemala",[ "country": "GT" { }, { "subArea"system": "Guatemala Zona 10phone", "area": "Guatemala", "country"value": "GT" +14722240000", } ], "linksuse": [null { } "rel": "self", "href": "/locator-dev/api/subArea?1=1&country=GT&area=Guatemala&pageNo=1&pageSize=5"] }, "position": { "rellongitude": "next"30.7983, "hreflatitude": "/locator-dev/api/subArea?1=1&country=GT&area=Guatemala&pageNo=2&pageSize=5"-10.25 }, ], "hoursOfOperation": "Mon-Fri,8:00,17:00", "totalNosOfRecords": 48, "currentPageNohealthCareServices": "1COV,STI", "status": "Showing 5 Areas"} } }] } |
You can also find the POSTMAN examples here.below:
1. DHIS2 Response: POSTMAN
FHIR Response: POSTMAN