Download a Route by ID

See files for this Use Case on GitHub here

You can download a route with the parameter route_id.

Description

When you are creating an Optimization Problem, it makes several routes. You can download any of them with the parameter route_id.

Solution

Optimization Parameters and Addresses

Let's choose the Single Depot Multiple Drivers option for this Use Case. You can create an Optimization Problem with these parameters:

ParameterTypeDescriptionHTTP method
api_keystringAPI KEY of the userGET
redirectintegerIf equal to 1, will be redirected, if 0 - notGET
addressesarrayValid JSON array of Address objects. Click here to see the JSON SchemaPOST
parametersRoute ParametersValid JSON string of RouteParameters object. Click here to see the JSON SchemaPOST

You can see the addresses on the map as:

Create an Optimization

The cURL example below shows you how to create new optimized routes for this Use Case:

ParameterTypeDescription
api_keystringAPI KEY of the user
input dataPOST dataValid JSON object string. Click here to see the JSON Schema
1 @ECHO OFF
2 :: Single Depot, Multiple Driver, No Time Window
3 
4 ::See video tutorial here: http://support.route4me.com/route-planning-help.php?id=manual0:tutorial2:chapter2:subchapter1
5 
6 SET URL=https://www.route4me.com/api.v4/optimization_problem.php
7 SET apikey=11111111111111111111111111111111
8 SET route_path_output=Points
9 
10 ECHO ON
11 
12 curl -o file1.txt -g -X POST -k -d "@single_depot_multiple_driver_notime_window_data.json" "%url%?api_key=%apikey%&route_path_output=%route_path_output%"
13 
14 timeout /t 30

You can expect an Optimization Problem (see link), which has generated some routes already.

View the Optimization details

You can get more details from the newly created Optimization Problem.

The endpoint: https://www.route4me.com/api.v4/optimization_problem.php

HTTP Parameters

AttributeTypeDescriptionHTTP
method
api_keystringAPI KEY of the userGET
optimization_problem_idstringOptimization problem IDGET


1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/api.v4/optimization_problem.php
4 SET apikey=11111111111111111111111111111111
5 SET optprobid=38D4E661BB49089B92C7722F86ED7181
6 
7 ECHO ON
8 
9 curl -o file1.txt -g -X GET -k "%url%?api_key=%apikey%&optimization_problem_id=%optprobid%"
10 
11 timeout /t 30

See sample RESPONSE JSON data here

In the RESPONSE you can see an array of the addresses, which belong to 5 generated routes:

"route_id": "43F55835F1E76003FF980547F77338BD"
"route_id": "5A5470EFF970C03AB919CDDBFB7C0E60"
"route_id": "B90FACD1ACD5A76FD22A43321FC28DF7"
"route_id": "BDBD0148A18BECE918E4A2F68F5326D8"
"route_id": "D514B1FF32A519AF49DF4DD7FD8A8577"

Let's download the following "route_id": "5A5470EFF970C03AB919CDDBFB7C0E60"

Download a Route by ID

After it's downloaded, you can see all of the chosen route's details:

The endpoint: https://www.route4me.com/api.v4/route.php

HTTP Parameters

AttributeTypeDescriptionHTTP
method
api_keystringAPI KEY of the userGET
route_idstringRoute IDGET
route_path_outputstringIf equal to 'Poitns', you'll get an array of the path points to next addressGET


1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/api.v4/route.php
4 SET apikey=11111111111111111111111111111111
5 SET routeid=5A5470EFF970C03AB919CDDBFB7C0E60
6 SET rpo=Points
7 
8 ECHO ON
9 
10 curl -o file1.txt -g -k -X GET "%url%?route_id=%routeid%&api_key=%apikey%&route_path_output=%rpo%"
11 
12 timeout /t 30

See sample RESPONSE JSON data here

You can draw the route on the map as:

The other 4 routes can be downloaded in the same way - all you have to do is change the parameter route_id.