Skip to content

Get Optimization Solution API

Easy To Integrate Maps & Location APIs & SDKs For Web & Mobile Applications

Powered with India's most comprehensive and robust mapping functionalities.

Getting Access

Before using the API in the your solution, please ensure that the related access is enabled in the Mappls Console, in the same project you set up for the Maps SDK.

  1. Copy and paste the generated access token from your API keys available in the dashboard in the sample code for interactive map development.
    • This APIs follow OAuth2 based security.
    • Access Token can be generated using Token Generation API.
    • To know more on how to create your access tokens, please use our authorization API URL. More details available here
    • The access token is a valid by default for 24 hours from the time of generation. This can be configured by you in the API console.
  2. Security Type VRP This APIs follow OAuth2 based security. To know more on how to create your authorization tokens, please use our authorization token URL. More details available here

Introduction

The Goal in route optimization (Job Assignment & Route Optimization) is to get an optimal set of routes for a fleet of vehicles to traverse in order to deliver to a given set of customers. It generalizes the well-known travelling salesman problem (TSP).

The objective of this API is to minimize the duration, determine and minimize vehicles used & optimize the distance travelled(optimized route), so it can reduce the overall cost and provide maximum profit.

This is the GET method API where we need to pass the requestID received from Post Optimization API output to get the status or the desired output of Route Optimization.

URL

https://apis.mappls.com/advancedmaps/vrp/v1/getOptimizationSolution

Output Description

Format: JSON

response

The response object has the following properties: | Key | Description | | ----------- | ----------- | | summary | object summarizing solution indicators | | | routes | array of route objects |

Summary

The summary object has the following properties:

Key Description
cost total cost for all routes
computing_times time in miliseconds taken for the output
unassigned number of tasks that could not be served
service total service time for all routes
violation
duration total travel time for all routes
waiting_time total waiting time for all routes
priority total priority sum for all assigned tasks
[delivery] total delivery for all routes
[pickup] total pickup for all routes
[distance] total distance for all routes

computing_times

A computing_times object has the following properties (for internal purposes only): | Key | Description | | ----------- | ----------- | | routing | | | solving | | | laoding | | | total | sum of routing, solving and loading |

Routes

A route object has the following properties:

Key Description
vehicle id of the vehicle assigned to this route
steps array of step objects
cost cost for this route
service total service time for this route
violations
duration total travel time for this route
waiting_time total waiting time for this route
priority total priority sum for tasks in this route
[delivery] total delivery for tasks in this route
[pickup] total pickup for tasks in this route
[description] vehicle description, if provided in input
[geometry] polyline encoded route geometry
[distance] total route distance

Steps

A step object has the following properties:

Key Description
type a string (either start, job, pickup, delivery, break or end)
arrival estimated time of arrival at this step
duration cumulated travel time upon arrival at this step
service service time at this step
violation
waiting_time waiting time upon arrival at this step
[description] step description, if provided in input
[location] coordinates array for this step (if provided in input)
[id] id of the task performed at this step, only provided if type value is job, pickup, delivery or break
[load] vehicle load after step completion (with capacity constraints)
[distance] traveled distance upon arrival at this step

HTTPS Method

GET

Security Type

This APIs follow OAuth2 based security. To know more on how to create your authorization tokens, please use our authorization token URL. More details available here

Request Headers

The API leverages OAuth 2.0 based security. Hence, the developer would need to send a request for access token using their client_id and client_secret to the OAuth API. Once validated from the OAuth API, the access_token and the token_type need to be sent as Authorization header with the value: “{token_type} {access_token}”.

  • Authorization: “token_type access_token”

Response Type

application/json

Request Parameters

There is only one parameter in the Get Optimization Solution API. The query parameter in the URL of Get Optimization Solution API where unique id received from Post Optimization API request will be given as an input.

  1. requestId (string): The request ID received in response of the postOptimizationRequest API.

Response Parameters

1. Summary - duration (integer): total traveled time for all routes. - delivery (integer): total number of delivery points for all routes. - cost (integer): total cost for all routes. - computing_times: time in seconds taken for the output (for internal purposes only). - routing - total : sum of routing, solving and loading - solving - loading - distance (integer): Total calculated distance for all routes. - waiting_time (integet): Total waiting time for all routes. - service (integer): Total service time for all routes in seconds. - violation : - pickup (integer): Total number of pickup for all routes. - unassigned : Number of tasks that could not be served. - priority : Total priority sum for all assigned tasks.

2. Routes - delivery (integer): Total number of delivery points for tasks on this route. - cost (integer): Cost for this route. - distance (integer): Total distance of this route. - waiting_time (integer): Total waiting time for this route. - violations : - description (string): Vehicle description (if provided in input). - pickup (integer): Total number of pickup tasks on this route. - priority (integer): Sum of priority assigned for tasks on this route. - steps (array): - duration (integer): Cumulative travel time upon arrival at this step. - load (integer): Vehicle load after step completion (with capacity constraints). - distance (integer): Traveled distance upon arrival at this step. - waiting_time (integer): waiting time upon arrival at this step. - arrival (integer): Estimated time of arrival at this step. - service (integer): Service time invested at this step. - description (string):step description (if provided in input). - location (float): Coordinates array for this step (if provided in input). - id (integer): id of the task performed at this step, only provided when type value is given as job, pickup, delivery or break - type (string): a string (either start, job, pickup, delivery, break or end) - job: - vehicle (integer): id of the vehicle assigned on this route. - duration (integer): Total traveled time on this route. - service (integer): Service time invested on this route. - geometry (string): Encoded polyline route geometry of this route.

3. Unassigned : unassigned job,vehicle and shipment on this route - location - location of the vehicle/job/shipment whichever is unassigned - id - id of the unassigned job/vehicle/shipment

Response Codes

Success

  1. 200: To denote a successful data submission.

Client-Side Issues

  1. 400: Bad Request, User made an error while creating a valid request.
  2. 401: Unauthorized, Developer’s key is not allowed to send a request.
  3. 403: Forbidden, Developer’s key has hit its daily/hourly limit.
  4. 409: Conflict.

Server-Side Issues

  1. 500: Internal Server Error, the request caused an error in our systems.
  2. 503: Service Unavailable, during our maintenance break or server downtimes.

Response Messages

  1. 200: Request Submitted Successfully.
  2. 400: Something’s just not right with the request.
  3. 401: Access Denied.
  4. 403: Forbidden, Services for this key has been suspended due to daily/hourly transactions limit.
  5. 409: Conflict.
  6. 500: Something went wrong.
  7. 503: Maintenance Break.

Sample Input (cURL)

Curl --location --request   GET 'https://apis.mappls.com/advancedmaps/vrp/v1/getOptimizationSolution?requestId=1da827b1-bf8f-11eb-afd9-4134b973424d' \
--header 'token: axxfxxddxxexx29xx5xx0xxdxxeexx77'

Sample Output(JSON)

{
    "summary": {
        "delivery": [
            3
        ],
        "cost": 5813,
        "computing_times": {
            "routing": 0.007,
            "total": 0.12100000000000001,
            "solving": 0.0,
            "loading": 0.114
        },
        "distance": 63877,
        "waiting_time": 0,
        "violations": [],
        "pickup": [
            1
        ],
        "unassigned": 0,
        "priority": 0,
        "duration": 5813,
        "routes": 1,
        "service": 1200,
        "setup": 0
    },
    "msg": "Completed",
    "routes": [
        {
            "delivery": [
                3
            ],
            "cost": 5813,
            "distance": 63877,
            "waiting_time": 0,
            "violations": [],
            "pickup": [
                1
            ],
            "priority": 0,
            "steps": [
                {
                    "duration": 0,
                    "load": [
                        3
                    ],
                    "distance": 0,
                    "waiting_time": 0,
                    "arrival": 1600419146,
                    "service": 0,
                    "violations": [],
                    "setup": 0,
                    "location": [
                        77.26894638016765,
                        28.550833533042766
                    ],
                    "type": "start"
                },
                {
                    "duration": 454,
                    "load": [
                        2
                    ],
                    "distance": 4125,
                    "waiting_time": 0,
                    "arrival": 1600419600,
                    "service": 300,
                    "violations": [],
                    "setup": 0,
                    "location": [
                        77.25014802489044,
                        28.56370655591404
                    ],
                    "id": 1,
                    "type": "job",
                    "job": 1
                },
                {
                    "duration": 1678,
                    "load": [
                        1
                    ],
                    "distance": 20637,
                    "waiting_time": 0,
                    "arrival": 1600421124,
                    "service": 300,
                    "violations": [],
                    "setup": 0,
                    "location": [
                        77.25046301534559,
                        28.67277872908568
                    ],
                    "id": 5,
                    "type": "job",
                    "job": 5
                },
                {
                    "duration": 3259,
                    "load": [
                        2
                    ],
                    "distance": 34731,
                    "waiting_time": 0,
                    "arrival": 1600423005,
                    "service": 300,
                    "violations": [],
                    "setup": 0,
                    "location": [
                        77.13402954533225,
                        28.687340657215927
                    ],
                    "id": 2,
                    "type": "job",
                    "job": 2
                },
                {
                    "duration": 4901,
                    "load": [
                        1
                    ],
                    "distance": 54721,
                    "waiting_time": 0,
                    "arrival": 1600424947,
                    "service": 300,
                    "violations": [],
                    "setup": 0,
                    "location": [
                        77.20054141166888,
                        28.563214295078236
                    ],
                    "id": 6,
                    "type": "job",
                    "job": 6
                },
                {
                    "duration": 5813,
                    "load": [
                        1
                    ],
                    "distance": 63877,
                    "waiting_time": 0,
                    "arrival": 1600426159,
                    "service": 0,
                    "violations": [],
                    "setup": 0,
                    "location": [
                        77.26894638016765,
                        28.550833533042766
                    ],
                    "type": "end"
                }
            ],
            "vehicle": 1,
            "duration": 5813,
            "service": 1200,
            "setup": 0,
            "geometry": "_kgmDsqrvMDb@Bl@Bb@@ZDl@FbAcAFk@Cm@?MACFCBEBE@I?E?CCGGKCM?gBDi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CDkB@aCAmACcCAqAAe@Ag@G{AAo@Ck@OgDE_AEiAQYMiDOiDAy@GuA?Qz@Av@Ax@AlDGJ?J?tACt@K^GdA_@pCqAh@Qv@Mh@GPAPArAOpBWvC_@tC_@@N_BRUD{Cd@yBRK@o@Fk@FQB{@Hs@Lo@RqAl@y@b@mA^_@Fs@HgBDqDDu@?{@D}@@?QEcBAo@?s@?y@?WHwCFoBRi@FkDDgBBeBLeEDiB@k@?m@AWCUIe@So@SYkAgBeAwBISU{@CU?s@Ba@Ha@DOZm@NWVYLKfA_An@_@`@[JMJWDMNi@ToA?wA@u@FgDFiDDgDFmCFoCDsC@O@i@DgB@wADkBH{D?]@Y@gAFuDBqABqA@w@BwAFw@JyAN{AViBTiA|@sCJa@t@aCr@_Cr@aCt@eCRm@jAoDv@qC`@mBFa@Do@Ba@HoAHiBPeENcEPsDNqDPsD@y@LcDLaDNaDNaDAwDKqDIoD_@mAI{BI{BGgBIgBGiBCm@ASE_BCc@Ag@Aa@GgBGgBGkBAu@Cg@E}AAUt@E|@Gj@CdBK|AI~AIt@IPCPCZO`@[FKLOR]Vk@Pi@DUFYBO@QD[P}CP{C@i@BiAEqDCqD?iA?}AAQCiBCiB?[BYD]HYbAoCPg@t@aCJ]JSR_@N[Vc@x@eAHKTURQvAoAJKfAw@jAcAlAcAbA{@jAcA\\WpAiAVSPMPS|@aAnAkAJIb@[r@g@|@e@\\ShAs@MSIKKSWImAqCkAqCDQDIFGJCP?D@HFx@`B\\GNGHEt@m@bA}@FEPG@CBEDA\\a@b@c@rAkArAkArAkArAiAZ]X]?K?EDGDGFCH?HBBBDFXOl@Ox@rCBLDNNn@FTBP@P@L"
        }
    ],
    "unassigned": [],
    "respCode": 200
}

Disclaimer

  1. This API is released for select use cases only; Please contact Mappls API Support or your account manager for discussions on usage of this solution.
  2. Mappls reserves the right to revoke access of this API at its own discrection.

Document Version History

Version Last Updated Author
0.0.1 November 2021 Mappls API Team (KB)

API Version History

Version Last Updated Author Revised Sections
0.1 2021-06-17 Mappls API Team (PS) Initial release

For any queries and support, please contact:

Email us at apisupport@mapmyindia.com

Support Need support? contact us!

@ Copyright 2024 CE Info Systems Ltd. All Rights Reserved.