Integration architecture options
Choosing an architecture
When choosing an integration architecture and designing tracking system customizations, keep the following in mind:
-
Planning and Track & Trace are different services. They are independent of each other. Even if your data is already available in the Planning service, you may not necessarily be able to use them in Track & Trace (and vice versa).
-
When calling the Planning API, all data on references, settings, and previously planned routes must be stored on the tracking system side.
-
The Planning service solves problems independently, so the data required to solve a problem must be passed in the request each time. For example, with additional planning.
You can upload data to or download data from a service via Excel or the API. You can open a planning task from the RouteQ interface and export it to Track & Trace.
Support for unique order numbers in Track & Trace is an important feature of all the integration architectures. If you need to postpone a scheduled order until the following day, add a prefix to the order number when re-submitting the order to Planning (for manual export).
Basic integration with RouteQ services
Method/Service |
Planning |
Track & Trace |
Planning and Track & Trace integration |
Via Excel |
Manually via Excel You need to fill out the Routes sheet |
Planning via Excel, manual export to Track & Trace. Learn more |
|
Via the API |
Planning via the API, manual export to Track & Trace. Learn more Full API integration. Learn more |
Note
Using presets (ready settings for route planning) can significantly ease and speed up integration, and in the future simplify the optimization of various planning scenarios.
During integration, specify the preset name. Any changes to the planning parameters will be done in the preset and will not affect the integration settings.
Geocoding
When you load data via Excel, the built-in geocoder is used. It automatically finds the coordinates for the addresses you have uploaded.
API requests are not processed through the geocoder. When using the API, you need to pass point coordinates rather than addresses. Therefore, you must geocode in advance on the side of the tracking system.
If the point list does not change, you can enter point coordinates in a look-up table for later use. If delivery addresses change regularly, you need additional integration with a geocoder.
With geocoding, the address must be accurate. You're more likely to get inaccurate coordinates if:
-
The address is unstructured: it's stored as a single address line and doesn't provide enough information (the placename is very common, but the region or city district isn't specified, or the street name is specified without the name of the city) or the information is irrelevant for determining coordinates (for example, the apartment number and intercom number are indicated).
-
The address line contains additional information, like phone numbers and comments.
We recommend the following:
-
Enable search suggestions and address verification during input (for example, for customers on the website and managers that place orders).
-
Separate the boxes for entering addresses, contact details, and comments on the side of the tracking system. This way, the geocoder only receives an address string with enough data necessary to determine the coordinates: the region, city, street, and building number.
-
To limit the coordinate search area, use the geocoder parameter bbox.
-
When you receive a response from the geocoder, use the precision tag value to precisely determine the building. If the precision isn't equal to
exact
ornumber
, inform the user that they need to provide a precise address.
Planning via Excel, manual export to Track & Trace
When to use this method
This integration method is a good choice for quickly rolling out the service to production or for a pilot implementation using small amounts of data.
We don't recommend using this integration method for tasks that require additional planning or where implementation will require a large number of manual steps.
Note
Additional planning tasks using small amounts of data can use the manual order input function in Track & Trace.
Diagram
Implementing integration
-
Download an Excel file from the tracking system in the required format.
-
Upload the resulting file to the Planning web interface and run the task. The addresses in the file will be geocoded automatically.
-
If necessary, edit the solution in the web interface.
-
Take the result from step 3 (with your edits) and upload it to Excel. As an option, you can upload a file to the tracking system to get information on scheduled routes.
-
Take the result from step 3 and export it to Track & Trace.
-
When the couriers are done, job performance data can be saved in Excel or uploaded to the tracking system for internal reports.
Planning via API, manual export to Track & Trace
When to use this method
This integration method is suitable for most tasks. It can be used as an intermediate solution prior to full API integration.
Diagram
Implementing integration
-
Before launching the task, the tracking system sends addresses to be geocoded. The geocoder returns coordinates and an accuracy flag.
-
If the coordinates are not accurate enough, adjust them manually.
-
After receiving the coordinates, the tracking system sends a request to add the task, which launches the planning process.
The service must return one of the following responses:
-
Code for successful task queuing and task
ID
. -
Error code.
Planning time depends on the number of points in a request. The tracking system periodically requests updates on the task status.
Note
At this stage, you can open the solution at
https://yandex.ru/courier/companies/<company_id>/depots/all/mvrp/<task_id>
, where:-
<company_id>
is the company ID. You can find it in Settings → Company → Company ID. -
<task_id>
is the taskid
.
-
-
If necessary, edit the solution in the web interface.
-
The final task
ID
depends on whether a task has been updated:-
If a solution has not been updated, routing information is available based on the original task
ID
. -
If a solution is edited, its task
ID
will change. To get information about the adjusted solution, use the API.
-
-
Take the result from step 4 and export it to Track & Trace.
-
When the couriers are done, job performance data can be saved in Excel.
Full API integration
When to use this method
This integration method is suitable when you need maximum flexibility or when you need to eliminate manual operations. This option assumes that planned routes must be stored on the side of the tracking system.
The process of importing planning results to Track & Trace is charted here.
Diagram
Implementing integration
-
Before launching the task, the tracking system sends addresses to be geocoded. The geocoder returns coordinates and an accuracy flag.
-
If the coordinates are not accurate enough, adjust them manually.
-
After receiving the coordinates, the tracking system sends a request to add the task, which launches the planning process.
The service must return one of the following responses:
-
Code for successful task queuing and task
ID
. -
Error code.
Planning time depends on the number of points in a request. The tracking system periodically requests updates on the task status.
Note
At this stage, you can open the solution at
https://yandex.ru/courier/companies/<company_id>/depots/all/mvrp/<task_id>
, where:-
<company_id>
is the company ID. You can find it in Settings → Company → Company ID. -
<task_id>
is the taskid
.
-
-
If necessary, edit the solution in the web interface.
-
The final task
ID
depends on whether a task has been updated:-
If a solution has not been updated, routing information is available based on the original task
ID
. -
If a solution is edited, its task
ID
will change. To get information about the adjusted solution, use the API.
-
-
Save the planned routes on the tracking system side. In certain cases, you can plan without assigning a specific courier.
After receiving data on planned routes, you can assign specific couriers on the side of the tracking system. This will be useful if:
-
Your couriers' exact schedule is unknown for the moment.
-
Ground transportation is used.
-
-
After assigning specific couriers, pass the route data to Track & Trace using the Track & Trace API. Take into account the API features when you update the following data:
-
Track & Trace can provide the following information after couriers have completed their tasks or while they are working:
Additional planning at the depot (vehicles have not left yet)
When to use this method
This integration method is suitable when information on some orders is available in advance, but others continue coming in until the couriers leave. This will require new orders to be included in previously planned routes.
Note
-
The tracking system must store planned route data.
-
The frequency and interval of additional planning depend on the specific business model.
Diagram
Implementing integration
-
The tracking system sends a task for initial planning using the Planning API and receives the result.
-
Save the resulting solution in the tracking system to use built routes for additional planning. In the meantime, new orders accumulate.
-
The tracking system sends a task for additional planning using the Planning API. Among other things, the tracking system must pass on:
-
Order data from the initial plan and previous additional planning.
-
Bindings between orders and vehicles based on previous additional planning (not to modify previously created routes).
-
New order data.
-
-
Save the new planned routes on the side of the tracking system for subsequent iterations of additional planning. In the meantime, new orders continue to accumulate.
-
Repeat Steps 3 and 4 as many times as necessary until you get the final version of the solution.
-
The tracking system sends the final version of the routes via the Track & Trace API.
Additional planning en route
When to use this method
This integration method is a good choice when couriers are already on their planned routes but new orders continue coming in during their work shift.
Note
-
The tracking system must store planned route data.
-
The frequency and interval of additional planning depend on the specific business model.
-
The planning service uses current vehicle location data. Normally, data on the most recent completed order is sufficient.
Diagram
Implementing integration
-
The tracking system sends a task for initial planning using the Planning API and receives the result.
-
Save the resulting solution in the tracking system to use for additional planning. In the meantime, new orders accumulate.
-
Information about routes is sent via the Track & Trace API.
-
In the meantime, the tracking system accumulates new orders to be added to the current plan. By this time, the couriers are already en route.
-
The Track & Trace service returns information on completed orders to the tracking system, including completion time for the most recent one (this can be a point in time in the past).
-
The tracking system sends a task for additional planning using the Planning API. A task must include:
-
Bindings between orders and vehicles based on previous additional planning (not to modify previously created routes).
-
The most recent completed order if it is used to determine vehicle location.
-
Other completed orders if they are pickup orders that need to be taken into account in load capacity calculations.
-
A sequence of the next few orders if couriers are following the planned order delivery sequence.
-
-
Save the new planned routes on the side of the tracking system for subsequent iterations of additional planning. In the meantime, new orders continue to accumulate.
-
The tracking system updates route information via the Track & Trace API. Repeat Steps 6 and 7 as many times as necessary until you get the final version of the solution.
Example sequence of the next few orders
A courier was delivering orders 1 through 5 when a new order number 6 came in. During additional planning, orders 1 through 3 have already been completed, so the additional planning request must contain information about order 3 (this being the vehicle starting point) and orders 4 through 6.
You also need:
-
To bind orders 3 through 5 to the courier since they were previously assigned to them.
-
To set orders 3 and 4 to be at the start of the route because the courier was already en route to order 4 at the time of additional planning.
This way, the courier will be able to deliver order 4, and the service will find an optimized sequence to complete orders 5 and 6.
You can find the charted samples for additional planning requests here.
Integration with the Yandex Courier app
When to use this method
This integration method makes it easier for couriers to use the Yandex Courier app.
Note
-
The courier's phone number and username must match and be formated as
+1хххххххххх
. -
If the courier is registered in multiple companies, they'll be asked to select one.
-
If the courier has multiple routes planned for today, they'll be asked to select one.
Implementing integration
-
Add the phone numbers of couriers who need to use the Yandex Courier app via Routing Workspace or the API.
-
Plan routes:
- Via Excel: Enter the courier's phone number in the Courier ID and Courier's phone number fields.
To correctly upload phone numbers with the
+
symbol to Track & Trace, enter the'
(single quote) symbol before the plus.
- Via the API: Enter the courier's phone number in the
vehicles.id
andvehicles.phone
fields.
- Via Excel: Enter the courier's phone number in the Courier ID and Courier's phone number fields.
To correctly upload phone numbers with the
-
Take the result from step 2 and export it to Track & Trace.
As a result, the courier won't have to enter their username to use the app.