POIs

Example 1 – Independent endpoint

In this example, we want to consult the restaurants and gyms on Avenida Afonso Pena, in the city of Campo Grande – MS. To do this, we set the parameter categories with the categories "ALIMENTOS_E_BEBIDAS" and "ACADEMIAS".

At bufferRouteInMeters we define the search radius along the route and at bufferStoppingPointsInMeters we define the search radius at the stopping points. In our case, the stopping points will be the points of origin and destination for each section of the route. Both will be defined as 500 meters.

The parameter onlyMyPlaces indicates whether we only want to consult the establishments in our proprietary database or whether we also want to consult the service’s native database. As in this example all the establishments have been previously registered, we will use the value true.

The parameter legs is an array of objects where each object represents a section of the route. In each leg, we must define the parameter points, which contains the coordinates that make up the route. In this case, we only have one leg which corresponds to the entire route.

The full request can be seen below:

{
    "categories": [
        "ALIMENTOS_E_BEBIDAS",
        "ACADEMIAS"
    ],
    "bufferRouteInMeters": 500,
    "bufferStoppingPointsInMeters": 500,
    "onlyMyPlaces": true,
    "legs": [
        {
            "points": [
                {
                    "latitude": -20.46317952376137,
                    "longitude": -54.612278411463116
                },
                {
                    "latitude": -20.463744,
                    "longitude": -54.615746
                },
                {
                    "latitude": -20.464,
                    "longitude": -54.615697
                },
                {
                    "latitude": -20.462782,
                    "longitude": -54.608564
                }
            ]
        }
    ]
}

The following information will be returned in the response:

  • total – Integer containing the number of establishments found in the search;
  • places – Array of objects, where each object represents an establishment. The following information will be returned:
    • id – Unique identifier of the establishment;
    • name – Name of establishment;
    • category – Category to which the establishment belongs;
    • subcategory – Subcategory to which the establishment belongs;
    • address – Object with address details:
      • street – String to enter the address;
      • number – String for the establishment number;
      • district – (Optional) String for the neighborhood;
      • city – String for city;
      • state – String for status;
      • zipcode – String for zip code;
      • point – Array with the coordinates of the establishment:
        • latitude – Latitude coordinate in decimal degrees;
        • longitude – Longitude coordinate in decimal degrees;
    • active – Boolean value indicating whether the establishment is active or not;
    • tags – Tags of the establishment, if any;
    • phones – Contact telephone numbers for the establishment, if available.

The full response can be found below:

{
    "total": 2,
    "legs": [
        {
            "total": 2,
            "places": [
                {
                    "id": "624c3ea5eab1c41162ba996c",
                    "name": "Restaurante Dummy",
                    "category": "ALIMENTOS_E_BEBIDAS",
                    "subCategory": "RESTAURANTES",
                    "address": {
                        "street": "Praça Tiradentes",
                        "number": "23",
                        "city": "Rio de Janeiro",
                        "state": "RJ",
                        "zipcode": "20060-070",
                        "point": {
                            "latitude": -22.90741716416432,
                            "longitude": -43.182738139927416
                        }
                    },
                    "active": true
                },
                {
                    "id": "62431d8583ce9c2ac592db3b",
                    "name": "Academia Y",
                    "category": "ACADEMIAS",
                    "subCategory": "ACADEMIAS",
                    "address": {
                        "street": "Avenida Brasil",
                        "number": "326",
                        "city": "Campo Grande",
                        "state": "MS",
                        "zipcode": "89848650",
                        "point": {
                            "latitude": -20.463744,
                            "longitude": -54.615746
                        }
                    },
                    "active": true
                }
            ]
        }
    ]
}