Locators / Organization Units near me
This endpoint provides list of organization units around the provided coordinates.
url : api/v2/locator
method: GET/POST
authorization: as setup in the Spring.Framework.Security
[Link]
Mandatory parameters - you must provide at least one of the following parameters
Parameter | dhis2 attribute | description |
---|---|---|
coordinates | User location or Latitude,Longitude near to which we want to find the organization Units. comma separate value | |
points | array of coordinates / decimal | |
latitude | ||
longitude | ||
Organization Unit | ||
uid | core | OrgUnit UID | UID generated by DHIS2 for a organization unit |
code | core | Org Unit Code | Code assigned to the organization unit |
shortName | core | Org Unit shortName | Short name of the organization unit |
Ancestor (Organization Unit) | ||
ancestor.uid | core | OrgUnit UID for ancestor | When UID / code for the ancestor is provided, then all the locator / facilities under it are populated |
ancestor.code | core | OrgUnit code for ancestor |
Optional parameters
Parameter | Option Value | Default Option | Description |
---|---|---|---|
paging | boolean | true | Defines if pagination is required |
page | number | 1 | Defines which page number to return. |
pageSize | number | 10 | Defines the total PageSize for the response |
distance | number | 10 | Defines radius within which you need to generate the organization Units |
unit | m | km | mi | km | Define the unit for the distance |
level | number | 7 | Defines hierarchy level of the orgUnit |
phoneNumber | text (phone Number) | N/A | DHIS2 core element | Defines the phone number of the location |
DHIS2 custom ou attribute | |||
type | text | Defines the type of the location. | |
tags | text (csv) | N/A | Defines the tags the locations are associated with. |
services | text (csv) | N/A | Defines the services offered by the locations. |
area | text | N/A | Defines the area where the locations is located. |
subArea | text | N/A | Defines the subArea where the locations is located. |
text (phone Number) | N/A | Defines the whatsapp number of the location | |
text | url | N/A | Defines the fb url for the location |
URL (for GET request):
https://{{host}}/api/v2/locator?paging=false&coordinates=lat,lng&distance=5&unit=km
Payload (for POST request):
{ "paging": true, "page": 1, "pageSize": 10, "ancestor": { "id": "a23acb2452xyz", "code": "KE" }, "organisationunit": { "id", "q13we2452wsd", "shortName": "Sub Hospital" }, "coordinates": lat,lng, "points": [lat,lng], "distance": 5, "unit": "km", "level": 7, "phoneNumber": "180999093107", "area": "Managua", "subArea": "Ciudad Sandino", "type": "Public", "tags": "tag1,tag2", "services": "service1,service2", "whatsapp": "977984123145", "facebook": "https://fb.me/facility1", "latitude": lat, "longitude": lon }
Response:
{ "pager": {...} "organisationUnits": [ { "id": "xkcEJARvo2O", "parentId": "15561086", "code": "KE-CODE-123", "name": "Facility Clinic (KE-CODE-123)", "shortName": "Facility Clinic", "description": null, "openingDate": "2023-02-11", "closedDate": null, "comment": null, "url": null, "contactPerson": null, "address": "street1, city, subarea, area", "email": "mymail@gmail.com", "phoneNumber": "+254541483334", "path": "", "level": "7", "area": "Nairobi", "subArea": "Starehe", "latitude": "-1.28575", "longitude": "39.81234", "geometry": "{\"type\":\"Point\",\"coordinates\":[39.81234,-1.28575]}", "distance": 0.0, "openingHours": "Mon-Fri,8:00,17:00;Sat,9:00,14:00;Public Holiday,9:00,14:00;Sun,Closed", "services": "CCS,CNT,ANC,STI,HVS,HVT", "locationType": "OUT", "type": "Public", "tags": "KEUNV", "fb": null, "whatsapp": null, "showContactInfo": "TLF" } ] }
Note: The attributes sequence might be different from the sequence listed above.