Re-Assigning an Existing Route to another User
See files for this Use Case on the GitHub here
Description
You can add as many users as you need to your account, as long as you stay within the total number of users permitted with your subscription plan.
You can share the routes with your employees or sub-contractors via e-mail or send them to their mobile device. Usually, if you use a sub-contractor time just once, you can send them a route by e-mail. But if you are sharing a route with a full-time employee, it is better to assign route to him directly.
Assigning routes to drivers can be helpful when splitting up the deliveries of your service. Splitting up the work between drivers is a great way to get the most out of the Route4Me service.
Solution
Optimization Parameters and addresses
Please pay attention to the following parameters, so you can apply correct parameters for this use case:
Parameter | Type | Description | HTTP method |
---|---|---|---|
api_key | string | API KEY of the user | GET |
redirect | integer | if equal to 1, will be redirected, if 0 - not | GET |
addresses | array | Valid JSON array of Address objects. Click here to see the JSON Schema | POST |
parameters | Route Parameters | Valid JSON string of RouteParameters object. Click here to see the JSON Schema | POST |
You can see the addresses on a map as:

Create an Optimization
You can create new optimization for this use case example. From the cUrl example bellow you can see that:
- the endpoint for this task is: https://www.route4me.com/api.v4/optimization_problem.php
- input data is stored in the file multi_depot_multi_driver_24stops_tw_data.json
Parameter | Type | Description |
---|---|---|
api_key | string | API KEY of the user |
input data | POST data | Valid JSON object string. Click here to see the JSON Schema |
You can expect an Optimization problem (see link), which generated 5 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
Attribute | Type | Description | HTTP method |
---|---|---|---|
api_key | string | API KEY of the user | GET |
optimization_problem_id | string | Optimization problem ID | GET |
See sample RESPONSE JSON data here
The system will send a RESPONSE with an array of addresses which belong to 5 generated routes:
Details of the Optimized Routes
See example for one route below. You can get the details of the remaining routes by using the same method and changing the parameter route_id.
The endpoint: https://www.route4me.com/api.v4/route.php
HTTP Parameters
Attribute | Type | Description | HTTP method |
---|---|---|---|
api_key | string | API KEY of the user | GET |
route_id | string | Route ID | GET |
route_path_output | string | If equal to 'Poitns', you'll get an array of the path points to next address | GET |
See sample RESPONSE JSON data here
- Note
- In the RESPONSE you can see the array of the fields path_to_next **. Those will be used to draw routes on a map, exactly as they generated by Route4Me API.
You can see a route on the map drawn by the Route4Me API as:

You can see all 5 routes drawn by the Route4Me API as:

Create a Driver with Route4Me API
You can create user account and each driver's acounts using Route4Me API.
HTTP Parameters
Attribute | Type | Description | HTTP method |
---|---|---|---|
api_key | string | API KEY of the user | GET |
plan | string | The plan type that the user selected - ENUM(free, basic, pro, premium, personal) | GET |
business_member_type | string | Member type of the user | GET |
strIndustry | string | The industry of the user | POST |
strFirstName | string | The first name of the user | POST |
strLastName | string | The last name of the user | POST |
strEmail | string | The email of the user | POST |
format | string | Response fromat ENUM [xml, json] | POST |
chkTerms | integer | If equal to 1, the user agreed to the terms of the site checkbox | POST |
device_type | string | Device type ("web", "iphone", "ipad", etc) | POST |
strPassword_1 | string | Password associated with this e-mail address | POST |
strPassword_2 | string | Password confirmation field | POST
|
The endpoint: https://www.route4me.com/actions/register_action.php
- Attention
- New user registration process requires user to provide a unique email. You can't register with the email from example below.
See sample RESPONSE JSON data here
Assign a Route to a Driver
You can reassign a route to a user (a driver, a sub-contractor). Let's pay attention to the route with route_id=4F9A4259F7C80127349ED8BB7F62A9E9 and to the block of the parameters in the appropriate RESPONSE JSON file (see the file here):
As you can notice, this route belongs to the user with member_id=1. You can reassign the route to the newly created driver with member_id=315948.
The endpoint: http://www.route4me.com/api.v4/route.php
HTTP Parameters
Attribute | Type | Description | HTTP method |
---|---|---|---|
api_key | string | API KEY of the user | GET |
route_id | string | Route ID | GET |
driver_id | integer | Driver ID | POST |
See sample INPUT JSON data here
See sample RESPONSE JSON data here
Pay attention to this parameter in the RESPONSE JSON file:
Re-Assigning a Route to an User
You can re-assign a route to a sub-contractor user.
The endpoint: http://www.route4me.com/api.v4/route.php
HTTP Parameters
Attribute | Type | Description | HTTP method |
---|---|---|---|
api_key | string | API KEY of the user | GET |
route_id | string | Route ID | GET |
member_id | integer | Member ID | POST |
member_email | string | Member e-mail | POST |
member_first_name | string | Member first name | POST |
member_last_name | string | Member last name | POST |
See sample INPUT JSON data here
See sample RESPONSE JSON data here
Pay attention to this block of the parameters in the RESPONSE JSON file: