# Location API

This API is for searching the closest location to the entered latitude longitude.

Field component explanation:

| **Field Name** | **Description**                                                                   |
| -------------- | --------------------------------------------------------------------------------- |
| Authorization  | Generated token id                                                                |
| CollName       | Collection which is used to store locations                                       |
| fieldName      | Field is used to store the location of the place.                                 |
| latlong        | latitude longitude usually separated using “;” (For example : -6.31082;106.81402) |
| d              | Distance (closest location search distance)                                       |

### **Get Location Data object by locationName, latlong, distance, start and count**

| Method     | GET                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Media Type | application/json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| URL        | http\://\[server]/dolphin/apiv1/graph/location/locationData?collName=\[collName]\&fieldName=\[fieldName]\&latlong=\[latlong]\&d=\[d]\&start=0\&count=2                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| Header     | <p>Authorization : Bearer \[generatedToken]<br>collName : \[collName]<br>fieldName : \[fieldName]<br>latlong : \[latitude;longitude]<br>d : \[distance]<br>count : \[count]</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Body       |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| Status     | 200                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| Response   | <p>{<br>“status”: “success”,<br>“data”: \[<br>    {<br>     “id”: “\[id]”,<br>     “branch\_code”: “\[branch\_code]”,<br>     “branch\_name”: “\[branch\_name]”,<br>     “branch\_address”: “\[branch\_address]”,<br>     “longitude”: \[longitude],<br>     “latitude”: \[latitude],<br>     “google\_map”: \[<br>       \[latitude], \[longitude]”<br>     ]<br>     “province\_id”: “\[province\_id]”,<br>     “regencycity\_id”: “\[regencycity\_id]”,<br>     “isaoallowed”: “1”,<br>     “*version*”: 1676781750912548900<br>   },<br>   {<br>     “id”: “\[id]”,<br>     “branch\_code”: “\[branch\_code]”,<br>     “branch\_name”: “\[branch\_name]”,<br>     “branch\_address”: “\[branch\_address]”,<br>     “longitude”: \[longitude],<br>     “latitude”: \[latitude],<br>     “google\_map”: \[<br>       \[latitude], \[longitude]”<br>     ]<br>     “province\_id”: “\[province\_id]”,<br>     “regencycity\_id”: “\[regencycity\_id]”,<br>     “isaoallowed”: “1”,<br>     “*version*”: 1676781751104438300<br>   }<br>],<br>“hasMore”: false,<br>“nextIndex”: 0,<br>“prevIndex”: 0,<br>“totalResults”: 0<br>}</p> |

### **Get Location Data object LocationInfo**

| Method     | POST                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Media Type | application/json                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| URL        | http\://\[server]/dolphin/apiv1/graph/location/geocode                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| Header     | Authorization : Bearer \[generatedToken]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| Body       | <p>{<br>“collname”: “\[collName]”,<br>“locationName”: “\[locationName]”,<br>“latlong”: “\[latitude;longitude]”,<br>“distance”: \[distance],<br>“start”: 0,<br>“count”: 2,<br>“sort”: true<br>}</p>                                                                                                                                                                                                                                                                                                                                                                                                                                |
| Status     | 200                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| Response   | <p>{<br>“status”: “success”,<br>“data”: \[<br>    {      “id”: “\[id]”,<br>     “branch\_code”: “\[branch\_code]”,<br>     “branch\_name”: “\[branch\_name]”,<br>     “branch\_address”: “\[branch\_address]”,<br>     “longitude”: \[longitude],<br>     “latitude”: \[latitude],<br>     “google\_map”: \[<br>       \[latitude], \[longitude]”<br>     ]<br>     “province\_id”: “\[province\_id]”,<br>     “regencycity\_id”: “\[regencycity\_id]”,<br>     “isaoallowed”: “1”,<br>     “*version*”: 1676781750944006100<br>   },<br>], “hasMore”: false,<br>“nextIndex”: 0,<br>“prevIndex”: 0,<br>“totalResults”: 0<br>}</p> |

### **Add Locations**

| Method     | POST                                                                                                                                                    |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Media Type | application/json                                                                                                                                        |
| URL        | http\://\[server]/dolphin/apiv1/graph/location/locationData/add/location                                                                                |
| Header     | <p>Authorization : Bearer \[generatedToken]<br>collName : \[collName]<br></p>                                                                           |
| Body       | <p>{<br>   “longitude”:\[longitude],<br>   “latitude”:\[latitude],<br>}</p>                                                                             |
| Status     | 200                                                                                                                                                     |
| Response   | <p>{<br>   “status”: “success”,<br>   “data”: \[],<br>   “hasMore”: false,<br>   “nextIndex”: 0,<br>   “prevIndex”: 0,<br>   “totalResults”: 0<br>}</p> |
