Dynamically Create a Fleet of Drivers

Attention
Please note that the content may be updated late as we expect a new versions of the endpoints that we discuss here.

Please see files for this Use Case on the GitHub here

You can dynamically create a fleet of drivers and allocate them to vehicles and routes, and then track their activity.

Description

Route4Me offers advanced team management features which you can use to effectively handle the way your routes are split among your drivers. User types in Route4Me application allow you to better manage and control your team members' accounts by setting different permissions for each user. The user of a "Driver" type can only view and edit routes assigned to them. Drivers also can synchronize their routes and navigate a route.

Solution

Get Information about Drivers Fleet

Suppose your company is planning routes with multi-driver option. You can split addresses you need to visit between different routes and allocate a driver to each route. First of all you need to know the list of existing fleet drivers. You can get information about drivers that belong to your account.

HTTP Parameters

Attribute Type Description HTTP
method
api_key string API KEY of the user GET
query string Text to be searched in some fields (member_first_name, member_last_name, member_email GET


The endpoint: https://www.route4me.com/api/member/view_users.php

1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/api/member/view_users.php
4 SET apikey=11111111111111111111111111111111
5 
6 :: View existing sub-users in a Member's account
7 
8 ECHO ON
9 
10 curl -o file1.txt -g -X GET -k "%URL%?api_key=%apikey%"
11 
12 timeout /t 30

See sample RESPONSE JSON data This endpoint requires clarification - will be finished soon

Create a Driver in a Route4Me Account

On your Route4Me account page, go to the “Team” tab, then click on “Users”.

All users under your account are arranged in a hierarchical structure. To add a new user, click “Add Sub-User” underneath the appropriate team leader and a new window will open.

When adding a user, be sure to fill in all required fields on the left section. You need to enter user's first and last name, e-mail, set a password for a user and assign a user type. Note that the valid email address is required. The email associated with a user can only be changed under that user's account.

Create a Driver with Route4Me API

You can create a user's account and, in particular, driver's account 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

1 @ECHO OFF
2 
3 SET url=https://www.route4me.com/actions/register_action.php
4 SET apikey=11111111111111111111111111111111
5 SET plan=free
6 
7 :: The example refers to a registration new Route4Me account.
8 
9 ECHO ON
10 
11 curl -k -X POST -H "Content-Type: multipart/form-data;" -F "strIndustry=Gifting" -F "strFirstName=Olman" -F "strLastName=Oland" -F "[email protected]" -F "format=json" -F "chkTerms=1" -F "device_type=web" -F "strPassword_1=111111" -F "strPassword_2=111111" "%url%?plan=%plan%&business_member_type=SUB_ACCOUNT_DRIVER"
12 
13 timeout /t 30

See sample RESPONSE JSON data here

Add a Driver to a Route

You can either assing a driver to a route during the optimization problem generation stage, or you can do that later. Suppose you have an already generated optimization problem with optimization_problem_id = 38D4E661BB49089B92C7722F86ED7181 and 5 optimized routes (see linkhere). Let us select a route with route_id = 43F55835F1E76003FF980547F77338BD and assign to a driver.

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


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

1 @ECHO OFF
2 
3 SET url=http://www.route4me.com/api.v4/route.php
4 SET apikey=11111111111111111111111111111111
5 SET routeid=43F55835F1E76003FF980547F77338BD
6 
7 ECHO ON
8 
9 curl -o file1.txt -g -X PUT -H "Content-Type: application/json" -d "@update_route_data.json" "%url%?route_id=%routeid%&api_key=%apikey%"
10 
11 timeout /t 30

See sample RESPONSE JSON data here

Pay attention to this part of the response:

"driver_id": "45837"
Note
you can change a driver associated with a route by using same endpoint described above - just put another driver_id value.

Change an Owner of a Driver

If a company has a complex TSM system and has several dispatchers, the managers need to have ability to change an owner of a driver. You can do that with Route4Me API.

HTTP Parameters

Attribute Type Description HTTP
method
api_key string API KEY of the user GET
member_id integer Driver ID GET
owner_member_id integer ID of a driver's owner GET


The endpoint: https://route4me.com/api/member/change_owner.php

1 @ECHO OFF
2 
3 SET url=https://route4me.com/api/member/change_owner.php
4 SET apikey=11111111111111111111111111111111
5 SET memebr_id=45837
6 SET owner_member_id=2
7 
8 ECHO ON
9 
10 curl -o file1.txt -g -X POST -k "%url%?api_key=%apikey%&memebr_id=%memebr_id%&owner_member_id=%owner_member_id%"
11 
12 timeout /t 30

You can expect this RESPONSE:

{
"status": true
}