Skip to content

Rest API's

shashank1501 edited this page Dec 30, 2021 · 1 revision

Rest API's

Place Details()

Request Parameters

a. Mandatory Parameters:
  1. eLoc: the id or eLoc of the place whose details are required. The 6-digit alphanumeric

code for any location. (e.g. mmi000).

  1. code : response code of api call

  2. response : success callback of api call

  3. error : error callback for api call

MapmyIndiaGL.RestApi.placeDetail({eLoc:"MMI000"})
.then(response => {
const data = JSON.parse(response);
})
.catch(error => console.log(error.code,error.message));

Place Details Legacy()

Request Parameters

a. Mandatory Parameters:
  1. eLoc: the id or eLoc of the place whose details are required. The 6-digit alphanumeric

code for any location. (e.g. mmi000).

  1. code : response code of api call

  2. response : success callback of api call

  3. error : error callback for api call

MapmyIndiaGL.RestApi.placeDetailLegacy({eLoc:"MMI000"})
.then(response => {
const data = JSON.parse(response);
})
.catch(error => console.log(error.code,error.message));

Atlas AutoSuggest()

Request Parameters

a. Mandatory Parameters:
  1. query (string) e.g. Shoes, Coffee, Versace, Gucci, H&M, Adidas, Starbucks, B130 {POI, House Number, keyword, tag}

  2. code : response code of api call

  3. response : success callback of api call

  4. error : error callback for api call

b. Optional Parameters:
  1. location(Location)

e.g. location:{longitude:28.56,latitude:77.56}

  1. zoom (double) = takes the zoom level of the current scope of the map (min: 4, max: 18).

  2. tokenizeAddress (boolean) = provides the different address attributes in a structured object.

  3. pod = it takes in the place type code which helps in restricting the results to certain chosen type.

Below mentioned are the codes for the pod -

  • MapmyIndiaGL.RestApi.AutoSuggestCriteria.POD_SUB_LOCALITY: Sublocality

  • MapmyIndiaGL.RestApi.AutoSuggestCriteria.POD_LOCALITY: Locality

  • MapmyIndiaGL.RestApi.AutoSuggestCriteria.POD_CITY: City

  • MapmyIndiaGL.RestApi.AutoSuggestCriteria.POD_VILLAGE: Village

  • MapmyIndiaGL.RestApi.AutoSuggestCriteria.POD_SUB_DISTRICT: Subdistrict

  • MapmyIndiaGL.RestApi.AutoSuggestCriteria.POD_DISTRICT: District

  • MapmyIndiaGL.RestApi.AutoSuggestCriteria.POD_STATE: State

  • MapmyIndiaGL.RestApi.AutoSuggestCriteria.POD_SUB_SUB_LOCALITY: Subsublocality

  1. filter = this parameter helps you restrict the result either by mentioning a bounded area or to certain eloc (6 digit code to any poi, locality, city, etc.), below mentioned are the both types -

a. filter = bounds: lat1, lng1; lat2, lng2 (latitude, longitude) {e.g. filter=bounds: 28.598882, 77.212407; 28.467375, 77.353513}

b. filter = cop: {eloc} (string) {e.g. filter=cop:YMCZ0J}

MapmyIndiaGL.RestApi.autoSuggest({query:  "Delhi", pod:MapmyIndiaGL.RestApi.AutoSuggestCriteria.POD_CITY})
.then(response => {
const data = JSON.parse(response);
})
.catch(error => console.log(error.code,error.message));

Atlas NearBy()

Request Parameters

a. Mandatory Parameters:
  1. keyword(String): performs search on the basis of provided keyword For eg: coffee, EV Charging Station etc

  2. location(Location) e.g. location:{longitude:28.56,latitude:77.56}

  3. code : response code of api call

  4. response : success callback of api call

  5. error : error callback for api call

b. Optional Parameters:
  1. sortBy(String): provides configured sorting operations for the client on cloud.Below are the available sorts:
  • MapmyIndiaGL.RestApi.NearbyCriteria.DISTANCE_ASCENDING

  • MapmyIndiaGL.RestApi.NearbyCriteria.DISTANCE_DESCENDING will sort the data on distance basis.

  • MapmyIndiaGL.RestApi.NearbyCriteria.NAME_ASCENDING

  • MapmyIndiaGL.RestApi.NearbyCriteria.NAME_DESCENDING will sort the data on alphabetically basis.

  1. page (integer): provides number of the page to provide results from.

  2. radius(integer): provides the range of distance to search over(default: 1000, min: 500, max: 10000)

  3. bounds(String): Allows the developer to send in map bounds to provide a nearby search within the bounds. {e.g. (bounds("28.56812,77.240519;28.532790,77.290854"))

  4. pod (string) : it takes in the place type code which helps in restricting the results to certain chosen type. Access to this parameter is controlled from the backend. This parameter if provided will override any values provided in keywords request param. Below mentioned are the codes for the pod

  • MapmyIndiaGL.RestApi.NearbyCriteria.POD_SUB_LOCALITY

  • MapmyIndiaGL.RestApi.NearbyCriteria.POD_LOCALITY

  • MapmyIndiaGL.RestApi.NearbyCriteria.POD_CITY

  • MapmyIndiaGL.RestApi.NearbyCriteria.POD_VILLAGE

  1. filter(String) : This parameter helps you get a specific type of EV charging Station
  • filter = model:(string);brandId:(string);plugType:(string)
  1. searchBy(String) :
MapmyIndiaGL.RestApi.nearby({keyword:  "Tea", location:'28.56,77,45'})
.then(response => {
const data = JSON.parse(response);
})
.catch(error => console.log(error.code,error.message));

RevGeocoding()

Request Parameters

a. Mandatory Parameters:
  1. latitude:(double) the latitude of the location for which the address is required.

  2. longitude:(double) the longitude of the location for which address is required.

  3. code : response code of api call

  4. response : success callback of api call

  5. error : error callback for api call

MapmyIndiaGL.RestApi.reverseGeocode({latitude:  lat, longitude:  lng})
.then(response => {
const data = JSON.parse(response);
})
.catch(error => console.log(error.code,error.message));

Atlas Geocoding()

Request Parameters

a. Mandatory Parameters:
  1. address(string) address to be geocoded e.g. 237 Okhla industrial estate phase 3 new delhi, delhi 110020

  2. code : response code of api call

  3. response : success callback of api call

  4. error : error callback for api call

b. Optional Parameters:
  1. itemCount (integer): parameter can be set to get maximum number of result items from the API (default: 1).

  2. bias : This parameter can be used to set Urban or Rural bias. A positive value sets the Urban bias and a negative value sets Rural bias. Allowed values are:

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.BIAS_DEFAULT: Default: (No bias)

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.BIAS_RURAL: Rural

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.BIAS_URBAN: Urban

Note: Currently Only for Android

  1. podFilter : This parameter can be used to set admin level restriction. The result will be either the given admin level or equivalent admin or higher in the hierarchy. No lower admin will be considered for geocoding. Allowed values are:
  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_HOUSE_NUMBER : house number

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_HOUSE_NAME : house name

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_POINT_OF_INTEREST : point of interest

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_STREET : street

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_SUB_SUB_LOCALITY : sub sub locality

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_VILLAGE : village

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_SUB_LOCALITY : sub locality

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_SUB_DISTRICT : sub district

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_LOCALITY : locality

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_CITY : city

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_DISTRICT : district

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_PINCODE :pincode

  • MapmyIndiaGL.RestApi.GeoCodingCriteria.POD_STATE : state

Note: Currently Only for Android

  1. bound (string): This parameter can be used to set admin boundary, which means geocoding will be done within the given admin. The allowed admin bounds are Sub-District, District, City, State and Pincode. The parameter accepts the admin eLoc as value.

Note: Currently Only for Android

Note: Please note that podFilter & bound parameters are mutually exclusive. They cannot be used together in an API call.

MapmyIndiaGL.RestApi.geocode({address:'Agra'})
.then(response => {
const data = JSON.parse(response);
})
.catch(error => console.log(error.code,error.message));

Direction()

Request Parameters

a. Mandatory Parameters:
  1. origin:{string (longitude[double],latitude[double])}

  2. destination: {string (longitude[double],latitude[double])}

  3. code : response code of api call

  4. response : success callback of api call

  5. error : error callback for api call

b. Optional Parameters:
  1. waypoints(Array): This parameter used to add waypoint to route. E.g.

waypoints:["77.67,28.56;77.69,28.89"]

  1. profile(String): Below are the available profile:
  • MapmyIndiaGL.RestApi.DirectionsCriteria.PROFILE_DRIVING (Default):Meant for car routing

  • MapmyIndiaGL.RestApi.DirectionsCriteria.PROFILE_WALKING: Meant for pedestrian routing. Routing with this profile is restricted to route_adv only. region & rtype request parameters are not supported in pedestrian routing

  • MapmyIndiaGL.RestApi.DirectionsCriteria.PROFILE_BIKING:Meant for two-wheeler routing. Routing with this profile is restricted to route_adv only. region & rtype request parameters are not supported in two-wheeler routing.

  • MapmyIndiaGL.RestApi.DirectionsCriteria.PROFILE_TRUCKING:Meant for Truck routing. Routing with this profile is restricted to route_adv only. region & rtype request parameters are not supported in truck routing.

  1. resource(String): Below are the available resource:
  • MapmyIndiaGL.RestApi.DirectionsCriteria.RESOURCE_ROUTE (Default): to calculate a route & its duration without considering traffic conditions.

  • MapmyIndiaGL.RestApi.DirectionsCriteria.RESOURCE_ROUTE_ETA get the updated duration of a route considering live traffic; Applicable for India only "region=ind" and "rtype=1" is not supported. This is different from route_traffic; since this doesn't search for a route considering traffic, it only applies delays to the default route.

  • MapmyIndiaGL.RestApi.DirectionsCriteria.RESOURCE_ROUTE_TRAFFIC:

to search for routes considering live traffic; Applicable for India only “region=ind” and “rtype=1” is not supported

  1. steps(Boolean):Return route steps for each route leg. Possible values are true/false. By default it will be used as false.

  2. overView(String): Add overview geometry either full, simplified according to highest zoom level it could be display on, or not at all. Below are the available value:

  • MapmyIndiaGL.RestApi.DirectionsCriteria.OVERVIEW_FULL

  • MapmyIndiaGL.RestApi.DirectionsCriteria.OVERVIEW_FALSE

  • MapmyIndiaGL.RestApi.DirectionsCriteria.OVERVIEW_SIMPLIFIED

  1. excludes(String...): Additive list of road classes to avoid, order does not matter. Below are the available value:
  • MapmyIndiaGL.RestApi.DirectionsCriteria.EXCLUDE_FERRY

  • MapmyIndiaGL.RestApi.DirectionsCriteria.EXCLUDE_MOTORWAY

  • MapmyIndiaGL.RestApi.DirectionsCriteria.EXCLUDE_TOLL

  1. alternatives(Boolean): Search for alternative routes.

  2. radiuses(double...): Limits the search to given radius in meters. For all way-points including start and end points.

  3. geometries(String): This parameter used to change the route geometry format/density (influences overview and per step).Below are the available value:

  • MapmyIndiaGL.RestApi.DirectionsCriteria.GEOMETRY_POLYLINE: with 5 digit precision

  • MapmyIndiaGL.RestApi.DirectionsCriteria.GEOMETRY_POLYLINE6 (Default): with 6 digit precision

MapmyIndiaGL.RestApi.direction({
origin:'77.56,28.56',
destination:'78.54,28.78',
profile:  MapmyIndiaGL.RestApi.DirectionsCriteria.PROFILE_DRIVING,
overview:  MapmyIndiaGL.RestApi.DirectionsCriteria.OVERVIEW_FULL,
})
.then(response => {
const data = JSON.parse(response);
})
.catch(error => console.log(error.code,error.message));

Distance()

a. Mandatory Parameters:
  1. coordinates:A array of coordinates which define the points to perform the matrix.

  2. code : response code of api call

  3. response : success callback of api call

  4. error : error callback for api call

b. Optional Parameters:
  1. profile(String) : Only supports MapmyIndiaGL.RestApi.DirectionsCriteria.PROFILE_DRIVING.

  2. resource(Strng): Below are the available value:

  • MapmyIndiaGL.RestApi.DirectionsCriteria.RESOURCE_DISTANCE (Default): to calculate the route & duration without considering traffic conditions.

  • MapmyIndiaGL.RestApi.DirectionsCriteria.RESOURCE_DISTANCE_ETA: to get the updated duration considering live traffic; Applicable for India only “region=ind” and “rtype=1” is not supported. This is different from distance_matrix_traffic; since this doesn't search for a route considering traffic, it only applies delays to the default route.

  • MapmyIndiaGL.RestApi.DirectionsCriteria.RESOURCE_DISTANCE_TRAFFIC: to search for routes considering live traffic; Applicable for India only “region=ind” and “rtype=1” is not supported

MapmyIndiaGL.RestApi.distance({coordinates:['77.56,27.56','77.56,28.56']})
.then(response => {
const data = JSON.parse(response);
})
.catch(error => console.log(error.code,error.message));

POI Along Route()

a. Mandatory Parameters:
  1. category(String):The POI category code to be searched. Only one category input supported.

  2. path(String): This parameter takes the encoded route along which POIs to be searched.

  3. code : response code of api call

  4. response : success callback of api call

  5. error : error callback for api call

b. Optional Parameters:
  1. buffer(Integer): Buffer of the road. Minimum value is 25, maximum is 1000 and default is 25.

  2. geometries(String): Type of geometry encoding.Below are the available geometries:

  • MapmyIndiaGL.RestApi.POICriteria.GEOMETRY_BASE64

  • MapmyIndiaGL.RestApi.POICriteria.GEOMETRY_POLYLINE6 (Default)

  • MapmyIndiaGL.RestApi.POICriteria.GEOMETRY_POLYLINE5

  1. page(Integer): Used for pagination. By default, a request returns maximum 10 results and to get the next 10 or so on pass the page value accordingly. Default is 1.

  2. sort(Boolean): Gets the sorted POIs along route.

MapmyIndiaGL.RestApi.POIAlongRoute({category:  'category', path:  'path'})
.then(response => {
const data = JSON.parse(response);
})
.catch(error => console.log(error.code,error.message));

Feedback()

a. Mandatory Parameters:
  1. typedKeyword (String) : The string that was searched. Must be 2 characters or more.

  2. eLoc (String) : eLoc of the location that was selected. Must be exactly 6 characters.

  3. index (Integer) : the index of the selected object that was returned from the search.

  4. userName (String) : the username of the user that’s logged in.

  5. appVersion (String) : the version of the app that was used to make the request.

  6. longitude (Double) : the longitude of the location from where the search is made. The longitude must be a double value, must not start with 0.

  7. latitude (Double) : the latitude of the location from where the search is made. The latitude must be a double value, must not start with 0 and must not be larger than the longitude.

  8. locationName (String ) : name of the location that was selected.

MapmyIndiaGL.RestApi.feedback({
typedKeyword:'',
eLoc:'',
index:0,
userName:'',
appVersion:'',
longitude:0.0,
latitude:0.0,
locationName:'',
})
.then(response => {
const data = JSON.parse(response);
})
.catch(error => console.log(error.code,error.message));

For any queries and support, please contact:

Email

Email us at apisupport@mapmyindia.com

Stack Overflow

Ask a question under the mapmyindia-api

Support

Need support? contact us!

Blog

Read about the latest updates & customer stories

© Copyright 2021. CE Info Systems Pvt. Ltd. All Rights Reserved. | Terms & Conditions