Find Nearest Location (Geoboundaries Retrieval in a Radius)
The Find Nearest Location API retrieves the list of the geoboundaries in a radius of interest (radius in which all the existing geoboundaries are to be returned) and any tags that are associated with the geoboundaries.
Use Case
The user first subscribes to the engagement server by calling the Create / Modify Subscriber API. The URL for this API is:
http://<host>:<port>/api/v1/subscribers
For example, this API could return ksid 5187099766488049525.
Next, you need to use Update Geolocation of the subscriber API. This API updates the geolocation of a subscriber with the provided ksid. The URL is as follows:
http://<host>:<port>/api/v1/location
Once you correlate the ksid of the subscriber with the location, you need to pass the ksid (same as regId or registrationId in the URL below), the radius of interest, page size, and any associated tags in the URL as input parameters. If the value of the radius and page size are not provided, the default radius used by the API is 20 miles and the default page size used by the API is 20.
URL
The HTTP URL for Find Nearest Location API is:
http://<host>:<port>/api/v1/geolocations/nearest/{regId}?radius=20&pageSize=20&tags=tag1,tag2,tag3
Method
GET
Output Parameters
The following fields are output parameters:
Sample Response
{
"refreshBoundary":
{ "distance": 0.20417458666360158, "latitude": 17.4483, "longitude": 78.3707 }
,
"locations": [
{
"id": 1,
"latitude": 17.4478,
"longitude": 78.3714,
"distance": 0.057562165562404836,
"clientAction": "notifyEngagementServer",
"message": "",
"customLogic": "",
"locationName": "kony",
"description": "",
"radius": 10,
"metaData": {},
"locationTags": [
"tag3"
]
},
{
"id": 2,
"latitude": 17.4484,
"longitude": 78.3738,
"distance": 0.20417458666360158,
"clientAction": "notifyEngagementServer",
"message": "",
"customLogic": "",
"locationName": "Dell",
"description": "",
"radius": 0.5,
"metaData": {},
"locationTags": [
"tag1"
]
},
{
"id": 3,
"latitude": 17.4706,
"longitude": 78.3837,
"distance": 1.7606183628649363,
"clientAction": "notifyEngagementServer",
"message": "",
"customLogic": "",
"locationName": "Hitech city MMTS",
"description": "",
"radius": 0.5,
"metaData": {},
"locationTags": [
"tag2"
]
}
]
}
Response Status
Code | Description |
---|---|
Status 200 | Nearest location details |
Status 400 | No subscriber found with the given ksid |
Status 401 | Unauthorized request |
Status 500 | Server failure to process request |