Netradyne Integration with NextBillion.ai’s Route Optimization API

Introduction

The integration of Netradyne's technology with NextBillion.ai's Route Optimization API is a significant step forward in the field of fleet management and road safety. Netradyne, known for its emphasis on driver safety, fleet efficiency, and data-driven insights, analyzes driver behavior and road conditions using advanced AI algorithms and real-time monitoring.

The Route Optimization API from NextBillion.ai provides businesses with a practical way to plan routes accurately, saving time and money while ensuring customer satisfaction. It includes real-time tracking and detailed analytics to monitor and improve fleet operations.

This integration combines the strengths of Netradyne and NextBillion.ai and provides businesses with a competitive advantage in the field. It simplifies and improves their daily operations by combining safety, efficiency, and innovation.

Prerequisites

To successfully integrate Netradyne with NextBillion.ai, ensure you have the following prerequisites in place:

  1. Netradyne's Authorization and Tenant Unique Name

  2. NextBillion.ai's API key: Obtain an API key from NextBillion.ai, which serves as the authentication mechanism for accessing their services and data. This key is essential for secure and authorized communication between your systems and NextBillion.ai's APIs.

Integration Steps

Generate Access Token

  • Generate Access token of Netradyne using the POST request. More details on the REST API requests can be found here

    https://api.netradyne.com/driveri/v1/auth/token
  • Verify Basic CRUD Operations: Finally, verify that basic CRUD (Create, Read, Update, Delete) operations are functioning as expected using the generated access token.

Pull List of Vehicles from Netradyne

Retrieve the list of vehicles from the Netradyne platform using the following API request.

Sample API Request

1
2
3
4
# Fetch vehicles from Netradyne
curl --location 'https://api.netradyne.com/driveri/v1/tenants/N546980211724797/vehicles' \
--header 'Accept-Language: en-US' \
--header 'Authorization: Bearer <access_token>'

Sample API Response

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
"totalCount": 46,
  "data": {
    "vehicles": [
      {
        "vin": "195192",
        "vehicleNumber": "195192",
        "licensePlateNumber": "string",
        "regdDate": 1694385610954,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694385610948,
        "vehicleDetails": {
          "class": "Unknown",
          "gVM": "52000 lb"
        },
        "batteryToMasterSwitchDisconnected": 0
      },
      {
        "vin": "123456789",
        "vehicleNumber": "2345",
        "licensePlateNumber": "4567890",
        "regdDate": 1668727922881,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1668727922883,
        "vehicleDetails": {
          "class": "CLASS1"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "1J4HA6H1XAL130149",
        "vehicleNumber": "Vista430",
        "licensePlateNumber": "TBD",
        "regdDate": 1681235423863,
        "status": 1,
        "deviceId": "3633015376",
        "camera": {
          "id": "3633015376"
        },
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1691015788503,
        "vehicleDetails": {
          "class": "CLASS6",
          "gVM": "22000 lb"
        },
        "batteryToMasterSwitchDisconnected": 1
      },
      {
        "vin": "5TBBT54117S452443",
        "vehicleNumber": "IMUTestRandy",
        "licensePlateNumber": "u8002s",
        "regdDate": 1647339413982,
        "status": 1,
        "deviceId": "264015804",
        "camera": {
          "id": "264015804"
        },
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1685115792723,
        "vehicleDetails": {
          "class": "CLASS2",
          "gVM": "10001 lb"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "5YJ3E1EA4LF611371",
        "vehicleNumber": "KFCModel3",
        "licensePlateNumber": "Temp",
        "regdDate": 1666802973800,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1692993365292,
        "vehicleDetails": {
          "class": "CLASS1",
          "gVM": "5000 lb"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "101844",
        "vehicleNumber": "101844",
        "licensePlateNumber": "CXAA123",
        "regdDate": 1694106162207,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694106162194,
        "vehicleDetails": {
          "class": "Unknown",
          "gVM": "52000 lb"
        },
        "batteryToMasterSwitchDisconnected": 0
      },
      {
        "vin": "0",
        "vehicleNumber": "580-130199",
        "licensePlateNumber": "2374484",
        "regdDate": 1694110935281,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "1000",
        "vehicleNumber": "827-1000",
        "licensePlateNumber": "CJ28557",
        "regdDate": 1694110935318,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "101845",
        "vehicleNumber": "115-101845",
        "licensePlateNumber": "C85252A",
        "regdDate": 1694110935326,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "146660",
        "vehicleNumber": "115-146660",
        "licensePlateNumber": "C07232F",
        "regdDate": 1694110935328,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "147451",
        "vehicleNumber": "115-147451",
        "licensePlateNumber": "C07234F",
        "regdDate": 1694110935329,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "157463",
        "vehicleNumber": "729-01",
        "licensePlateNumber": "2385576",
        "regdDate": 1694110935330,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "170364",
        "vehicleNumber": "595-170364",
        "licensePlateNumber": "None",
        "regdDate": 1694110935333,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "192071",
        "vehicleNumber": "656-192071",
        "licensePlateNumber": "12345",
        "regdDate": 1694110935335,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "193627",
        "vehicleNumber": "113-12",
        "licensePlateNumber": "V009DU",
        "regdDate": 1694110935336,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "195189",
        "vehicleNumber": "767-909",
        "licensePlateNumber": "B77085V",
        "regdDate": 1694110935337,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "2",
        "vehicleNumber": "650-560",
        "licensePlateNumber": "QTN600",
        "regdDate": 1694110935339,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "23",
        "vehicleNumber": "848-01",
        "licensePlateNumber": "96089V1",
        "regdDate": 1694110935341,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "5302023",
        "vehicleNumber": "650-674",
        "licensePlateNumber": "BHQ735",
        "regdDate": 1694110935342,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "602",
        "vehicleNumber": "10-602",
        "licensePlateNumber": "02860H1",
        "regdDate": 1694110935344,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "638098",
        "vehicleNumber": "115-638098",
        "licensePlateNumber": "B54314W",
        "regdDate": 1694110935347,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "638102",
        "vehicleNumber": "115-638102",
        "licensePlateNumber": "B54318W",
        "regdDate": 1694110935348,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "638103",
        "vehicleNumber": "115-638103",
        "licensePlateNumber": "B54319W",
        "regdDate": 1694110935350,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "638107",
        "vehicleNumber": "564-08",
        "licensePlateNumber": "87060L1",
        "regdDate": 1694110935352,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "676202",
        "vehicleNumber": "1487-676202",
        "licensePlateNumber": "B97217Y",
        "regdDate": 1694110935356,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "827991",
        "vehicleNumber": "827-887",
        "licensePlateNumber": "CD85881",
        "regdDate": 1694110935358,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "846-3631",
        "vehicleNumber": "564-16",
        "licensePlateNumber": "42876K1",
        "regdDate": 1694110935361,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "8463035",
        "vehicleNumber": "767-47",
        "licensePlateNumber": "C58881E",
        "regdDate": 1694110935363,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "915-2304",
        "vehicleNumber": "25-9152304",
        "licensePlateNumber": "B78438U",
        "regdDate": 1694110935364,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "999998",
        "vehicleNumber": "767-336",
        "licensePlateNumber": "C24427A",
        "regdDate": 1694110935366,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "999999",
        "vehicleNumber": "767-104",
        "licensePlateNumber": "B54321W",
        "regdDate": 1694110935367,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "101844555",
        "vehicleNumber": "115-101844",
        "licensePlateNumber": "C85214A",
        "regdDate": 1694110935369,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "170365",
        "vehicleNumber": "595-170365",
        "licensePlateNumber": "None222233",
        "regdDate": 1694110935370,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "170367",
        "vehicleNumber": "595-170367",
        "licensePlateNumber": "None2222",
        "regdDate": 1694110935371,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "170368",
        "vehicleNumber": "595-170368",
        "licensePlateNumber": "111111",
        "regdDate": 1694110935373,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "JM287",
        "vehicleNumber": "580-130599",
        "licensePlateNumber": "2374485",
        "regdDate": 1694110935374,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "638094",
        "vehicleNumber": "1665-638094",
        "licensePlateNumber": "B49906W",
        "regdDate": 1694110935346,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "170051",
        "vehicleNumber": "115-170051",
        "licensePlateNumber": "C98272G",
        "regdDate": 1694110935332,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694110935272,
        "vehicleDetails": {
          "class": "Unknown"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "1FTFW1ET7DKF98945",
        "vehicleNumber": "TESLA-MODEL-S",
        "licensePlateNumber": "JBOND007",
        "regdDate": 1661454087687,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1692993273687,
        "vehicleDetails": {
          "class": "CLASS1",
          "gVM": "5000 lb"
        },
        "batteryToMasterSwitchDisconnected": 2
      },
      {
        "vin": "157465",
        "vehicleNumber": "157465",
        "licensePlateNumber": "W643NP",
        "regdDate": 1694119695305,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694119695290,
        "vehicleDetails": {
          "class": "Unknown",
          "gVM": "52000 lb"
        },
        "batteryToMasterSwitchDisconnected": 0
      },
      {
        "vin": "1002",
        "vehicleNumber": "1002",
        "licensePlateNumber": "CJ28559",
        "regdDate": 1694123204992,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694123204982,
        "vehicleDetails": {
          "class": "Unknown",
          "gVM": "52000 lb"
        },
        "batteryToMasterSwitchDisconnected": 0
      },
      {
        "vin": "164577",
        "vehicleNumber": "164577",
        "licensePlateNumber": "2385582",
        "regdDate": 1694124996237,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694124996219,
        "vehicleDetails": {
          "class": "Unknown",
          "gVM": "52000 lb"
        },
        "batteryToMasterSwitchDisconnected": 0
      },
      {
        "vin": "203605",
        "vehicleNumber": "203605",
        "licensePlateNumber": "123",
        "regdDate": 1694212437903,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694212437896,
        "vehicleDetails": {
          "class": "Unknown",
          "gVM": "52000 lb"
        },
        "batteryToMasterSwitchDisconnected": 0
      },
      {
        "vin": "137283",
        "vehicleNumber": "137283",
        "licensePlateNumber": "C54133E",
        "regdDate": 1694127005625,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694127005617,
        "vehicleDetails": {
          "class": "Unknown",
          "gVM": "52000 lb"
        },
        "batteryToMasterSwitchDisconnected": 0
      },
      {
        "vin": "116039",
        "vehicleNumber": "116039",
        "licensePlateNumber": "C70707B",
        "regdDate": 1694135020850,
        "status": 1,
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1694135020840,
        "vehicleDetails": {
          "class": "Unknown",
          "gVM": "52000 lb"
        },
        "batteryToMasterSwitchDisconnected": 0
      },
      {
        "vin": "JHMCP26748C047713",
        "vehicleNumber": "KFCAccord",
        "licensePlateNumber": "6DKM149",
        "regdDate": 1647339375272,
        "status": 1,
        "deviceId": "264094871",
        "camera": {
          "id": "264094871"
        },
        "tenantUniqueName": "N546980211724797",
        "updatedOn": 1695061928041,
        "vehicleDetails": {
          "class": "CLASS1",
          "gVM": "5000 lb"
        },
        "batteryToMasterSwitchDisconnected": 2
      }
    ]
}

This API response includes essential information about each vehicle, such as VIN (Vehicle Identification Number), vehicle number, license plate number, registration date, status, and additional details about the vehicle's class, gross vehicle weight (gVM), and battery status.

Delivery Records Integration

The delivery records will be linked to the jobs parameter within NextBillion.ai's Route Optimization API. To facilitate testing and integration, we have generated a set of random jobs that can be employed for route optimization evaluation. However, for real-world scenarios, users have the flexibility to substitute these random jobs with their specific delivery addresses or job data.

Here are the key steps involved in this process:

  • Download Sample CSV File: We provide a sample CSV file containing randomly generated job data. You can download this file to understand the format and structure required for the job data.

  • Upload Job Data in CSV Format: After customizing your job data in CSV format, you can upload it into the system. This step ensures that your specific delivery addresses or job details are seamlessly integrated and optimized using NextBillion's Route Optimization API.

docs-image

Configuration of Additional Parameters

In our technical integration process, apart from the core parameters, there are additional settings that play a crucial role in fine-tuning the route optimization. These settings allow for a more comprehensive and customized optimization process. Here's how to configure these parameters:

  1. Driver's Shift Start and End Time: Define the start and end times of the driver's shift within the application. This sets the timeframe during which the route optimization should take place, ensuring alignment with the driver's working hours.

  2. Start and End Vehicle Locations: Specify the initial and final locations for the vehicle. Typically, this corresponds to the vehicle's departure point (e.g., the warehouse) and its return location after completing deliveries. These locations serve as critical reference points for route calculation.

  3. Service Time: The service time represents the duration required by the delivery executive to fulfill each order. Accurate service time input is essential for realistic route optimization.

Once all these parameters are correctly configured to match your specific operational requirements, you're ready to proceed.

docs-image

Integration with Route Optimization API

After successfully pulling the necessary data from Netradyne, integrate the fetched data with Route Optimization using the following API endpoint.

Map the fetched Netradyne data to the respective API parameters. Configure optimization settings such as shift start and end time, service time, and start and end location coordinates.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
let vehicles = [];
let shifts = [];
let starts = [];
let ends = [];
let veh_attr = [];
let stop_attr = [];
let vehicle_index = 1;
let shiftStart = (new Date(dtShiftStart2.value).getTime()/1000);
let shiftEnd = (new Date(dtShiftEnd2.value).getTime()/1000);

// START NBAI PROBLEM BUILD
let locations = [];
let jobs = [];
let shipments = [];
vehicles = [];
veh_attr = [];
stop_attr = [];
// sequence through all stops and create job array while
// also creating the indexed list of locations 
let location_index = 0;
let location = [];
addressess.data.forEach(planstop => {
    let from = new Date(planstop.from).getTime() / 1000;
  let to = new Date(planstop.to).getTime() / 1000;

      let job = {
        id: parseInt(planstop.ID),
        description: planstop.Dropoff,
        location_index: location_index++,
        service: numberInput1.value,
        priority: 0,
        time_windows: [[from,to]]
      }
      location.push(`${planstop.dropoff_latitude},${planstop.dropoff_longitude}`);

      jobs.push(job);
  
});

// Add shift start/stop location to location index
location.push(`${txtVehicleStartPosition2.value}`);
location.push(`${txtVehicleEndPosition2.value}`);
location_index += 1;
let veh_fixed_cost = 0;
tblVehicles.data.forEach( (v,idx) => {
  let breaks = [];
  let vehicle = {
    id: vehicle_index++,
    start_index: location_index,
    time_window: [shiftStart, shiftEnd],
    max_tasks: 25,
    costs: {
      fixed: veh_fixed_cost
    }
  };
    vehicles.push(vehicle);
    veh_fixed_cost += 0;
});

locations = {
  id: 12,
  description: 'Netradyne Test',
  location: location
};

let options = {
  routing: {
    mode: "car"
  }
};

localStorage.setValue('vehiclesNBAI', vehicles);
localStorage.setValue('shipmentsNBAI', shipments);
localStorage.setValue('jobsNBAI', jobs);
localStorage.setValue('locationsNBAI', locations);
localStorage.setValue('nbaiOptions', options);
localStorage.setValue('nbaiVRPResult', null);
nbaiOptimizationRun.trigger();

Follow these steps to achieve a successful integration:

Step 1: Define Data Structures

Begin by setting up the necessary data structures to facilitate the integration. These include arrays and variables for vehicles, shifts, start and end locations, vehicle attributes, and stop attributes.

1
2
3
4
5
6
let vehicles = [];
let shifts = [];
let starts = [];
let ends = [];
let veh_attr = [];
let stop_attr = [];

Step 2: Configure Optimization Settings

Specify optimization settings to tailor the routing process to your specific needs. These settings typically include shift start and end times, service times, and the coordinates of start and end locations.

1
2
let shiftStart = (new Date(dtShiftStart2.value).getTime() / 1000);
let shiftEnd = (new Date(dtShiftEnd2.value).getTime() / 1000);

Step 3: Prepare Data for Route Optimization

Assemble the data required for route optimization. This involves creating arrays for locations, jobs, and shipments. Additionally, you'll populate the vehicle and job attributes as needed.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
let locations = [];
let jobs = [];
let shipments = [];
vehicles = [];
veh_attr = [];
stop_attr = [];
// sequence through all stops and create job array while
// also creating the indexed list of locations 
let location_index = 0;
let location = [];
addressess.data.forEach(planstop => {
    let from = new Date(planstop.from).getTime() / 1000;
  let to = new Date(planstop.to).getTime() / 1000;

      let job = {
        id: parseInt(planstop.ID),
        description: planstop.Dropoff,
        location_index: location_index++,
        service: numberInput1.value,
        priority: 0,
        time_windows: [[from,to]]
      }
      location.push(`${planstop.dropoff_latitude},${planstop.dropoff_longitude}`);

      jobs.push(job);
  
});

// Add shift start/stop location to location index
location.push(`${txtVehicleStartPosition2.value}`);
location.push(`${txtVehicleEndPosition2.value}`);
location_index += 1;
let veh_fixed_cost = 0;
tblVehicles.data.forEach( (v,idx) => {
  let breaks = [];
  let vehicle = {
    id: vehicle_index++,
    start_index: location_index,
    time_window: [shiftStart, shiftEnd],
    max_tasks: 25,
    costs: {
      fixed: veh_fixed_cost
    }
  };
    vehicles.push(vehicle);
    veh_fixed_cost += 0;
});

locations = {
  id: 12,
  description: 'Netradyne Test',
  location: location
};

let options = {
  routing: {
    mode: "car"
  }
};

Step 4: Store Data and Trigger Optimization

Store the prepared data structures in local storage for future reference and initiate the route optimization process.

1
2
3
4
5
6
7
8
localStorage.setValue('vehiclesNBAI', vehicles);
localStorage.setValue('shipmentsNBAI', shipments);
localStorage.setValue('jobsNBAI', jobs);
localStorage.setValue('locationsNBAI', locations);
localStorage.setValue('nbaiOptions', options);
localStorage.setValue('nbaiVRPResult', null);

nbaiOptimizationRun.trigger();

By following these steps, you can effectively connect and integrate Netradyne data with the Route Optimization API, ensuring efficient routing and resource allocation for your tasks or deliveries.

Create Jobs with Route Optimization API

The following API request sends data to NextBillion.ai’s Route Optimization API to create optimization jobs based on certain parameters. The response confirms the creation of jobs.

POST API Request

1
2
curl --request POST \
    --url https://api.nextbillion.io/optimization/v2?key={{localStorage.values.apiKey}}

POST API Response

1
2
3
4
5
{
  "id": "cb35dbf1c45e6b86309e3bea880afb39",
  "message": "Optimization job created",
  "status": "Ok"
}

Retrieving Optimized Route Result

To obtain the optimized route results after initiating a route optimization job, you can utilize the provided GET query. This query enables you to fetch the optimized route details from the Route Optimization API.

GET Query

https://api.nextbillion.io/optimization/v2/result?id={{nbaiOptimizationRun.data.id}}&key={{localStorage.values.apiKey}}

In the above URL, two query parameters are used:

id: This parameter specifies the unique identifier associated with the optimization job. It is obtained from the nbaiOptimizationRun.data.id variable. key: The localStorage.values.apiKey variable provides the API key necessary for authentication.

Example JSON Response

Upon making the GET request, the API will respond with a JSON object containing the optimized route details. Here's an example of what the JSON response may look like.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
{
	"result": {
		"code": 0,
		"summary": {
			"cost": 18288,
			"routes": 7,
			"unassigned": 3,
			"setup": 0,
			"service": 2640,
			"duration": 18288,
			"waiting_time": 7583,
			"priority": 0,
			"distance": 234183.2
		},
		"unassigned": [
			{
				"id": 13,
				"type": "job",
				"location": [
					33.81422221,
					-118.324702
				]
			},
			{
				"id": 18,
				"type": "job",
				"location": [
					33.85713183,
					-118.1848631
				]
			},
			{
				"id": 7,
				"type": "job",
				"location": [
					34.11127624,
					-118.310787
				]
			}
		],
		"routes": [
			{
				"vehicle": 17,
				"cost": 53,
				"steps": [
					{
						"type": "start",
						"arrival": 1696599907,
						"duration": 0,
						"service": 0,
						"waiting_time": 0,
						"location": [
							33.908,
							-118.309
						],
						"location_index": 26
					},
					{
						"type": "job",
						"arrival": 1696599960,
						"duration": 53,
						"service": 120,
						"waiting_time": 0,
						"location": [
							33.90833078,
							-118.3091601
						],
						"location_index": 0,
						"id": 1,
						"description": "13528 South Western Avenue, Gardena, CA 90249, United States"
					},
					{
						"type": "end",
						"arrival": 1696600080,
						"duration": 53,
						"service": 0,
						"waiting_time": 0,
						"location": [
							33.90833078,
							-118.3091601
						],
						"location_index": 0
					}
				],
				"service": 120,
				"duration": 53,
				"waiting_time": 0,
				"priority": 0,
				"distance": 253,
				"geometry": "ys}mEffbqU?V[?Q?K?GEKGg@?_@?O?iAA?L?Nt@?x@?F?h@ADC??"
			},
			{
				"vehicle": 3,
				"cost": 3934,
				"steps": [
					{
						"type": "start",
						"arrival": 1696585241,
						"duration": 0,
						"service": 0,
						"waiting_time": 0,
						"location": [
							33.908,
							-118.309
						],
						"location_index": 26
					},
					{
						"type": "job",
						"arrival": 1696586940,
						"duration": 1699,
						"service": 120,
						"waiting_time": 0,
						"location": [
							34.08885568,
							-118.2424434
						],
						"location_index": 20,
						"id": 21,
						"description": "Elysian Park, Los Angeles, CA 90026, United States"
					},
					{
						"type": "job",
						"arrival": 1696589295,
						"duration": 3934,
						"service": 120,
						"waiting_time": 0,
						"location": [
							34.13764673,
							-118.3233027
						],
						"location_index": 24,
						"id": 25,
						"description": "4008 Mount Lee Drive, Los Angeles, CA 90068, United States"
					},
					{
						"type": "end",
						"arrival": 1696589415,
						"duration": 3934,
						"service": 0,
						"waiting_time": 0,
						"location": [
							34.13764673,
							-118.3233027
						],
						"location_index": 24
					}
				],
				"service": 240,
				"duration": 3934,
				"waiting_time": 0,
				"priority": 0,
				"distance": 42968.1,
				"geometry": "ys}mEffbqU?V[?Q?K?GEKGg@?_@?O?iAAkA@gA?_A@QJ_BAaA?{@A{@BLNp@FVHt@D`A????"
			},
			{
				"vehicle": 4,
				"cost": 3554,
				"steps": [
					{
						"type": "start",
						"arrival": 1696593012,
						"duration": 0,
						"service": 0,
						"waiting_time": 0,
						"location": [
							33.908,
							-118.309
						],
						"location_index": 26
					},
					{
						"type": "job",
						"arrival": 1696594040,
						"duration": 1028,
						"service": 120,
						"waiting_time": 0,
						"location": [
							33.86482007,
							-118.1456644
						],
						"location_index": 16,
						"id": 17,
						"description": "6025 Castana Avenue, Lakewood, CA 90712, United States"
					},
					{
						"type": "job",
						"arrival": 1696594980,
						"duration": 1848,
						"service": 120,
						"waiting_time": 0,
						"location": [
							33.8436929,
							-118.0226021
						],
						"location_index": 15,
						"id": 16,
						"description": "6272 San Lorenzo Drive, Buena Park, CA 90620, United States"
					},
					{
						"type": "job",
						"arrival": 1696596217,
						"duration": 2965,
						"service": 120,
						"waiting_time": 3023,
						"location": [
							34.00815079,
							-118.0675167
						],
						"location_index": 2,
						"id": 3,
						"description": "4431 Abbeywood Avenue, Pico Rivera, CA 90660, United States"
					},
					{
						"type": "job",
						"arrival": 1696599949,
						"duration": 3554,
						"service": 120,
						"waiting_time": 311,
						"location": [
							34.01040855,
							-117.9928211
						],
						"location_index": 22,
						"id": 23,
						"description": "1631 Doverfield Avenue, Hacienda Heights, CA 91745, United States"
					},
					{
						"type": "end",
						"arrival": 1696600380,
						"duration": 3554,
						"service": 0,
						"waiting_time": 0,
						"location": [
							34.01040855,
							-117.9928211
						],
						"location_index": 22
					}
				],
				"service": 480,
				"duration": 3554,
				"waiting_time": 3334,
				"priority": 0,
				"distance": 73739.6,
				"geometry": "ys}mEffbqU?Vf@?rA?H?fA@jA?J?\\?\\?V?Z?X?N?d@?p@?X?R?zA`@|@d@f@VXNfAh@JFf@XXLLLTDLBX?dAA??"
			},
			{
				"vehicle": 5,
				"cost": 4607,
				"steps": [
					{
						"type": "start",
						"arrival": 1696592821,
						"duration": 0,
						"service": 0,
						"waiting_time": 0,
						"location": [
							33.908,
							-118.309
						],
						"location_index": 26
					},
					{
						"type": "job",
						"arrival": 1696593297,
						"duration": 476,
						"service": 120,
						"waiting_time": 0,
						"location": [
							33.94764688,
							-118.3161763
						],
						"location_index": 7,
						"id": 8,
						"description": "9724 Haas Avenue, Los Angeles, CA 90047, United States"
					},
					{
						"type": "job",
						"arrival": 1696594560,
						"duration": 1619,
						"service": 120,
						"waiting_time": 0,
						"location": [
							34.01314638,
							-118.3507868
						],
						"location_index": 5,
						"id": 6,
						"description": "4534 Pinafore Street, Los Angeles, CA 90008, United States"
					},
					{
						"type": "job",
						"arrival": 1696595554,
						"duration": 2493,
						"service": 120,
						"waiting_time": 0,
						"location": [
							34.05322352,
							-118.3056606
						],
						"location_index": 1,
						"id": 2,
						"description": "975 South Hobart Boulevard, Los Angeles, CA 90006, United States"
					},
					{
						"type": "job",
						"arrival": 1696596243,
						"duration": 3062,
						"service": 120,
						"waiting_time": 0,
						"location": [
							34.06801078,
							-118.2863727
						],
						"location_index": 9,
						"id": 10,
						"description": "320 South Virgil Avenue, Los Angeles, CA 90020, United States"
					},
					{
						"type": "job",
						"arrival": 1696597211,
						"duration": 3910,
						"service": 120,
						"waiting_time": 0,
						"location": [
							34.09750474,
							-118.2193071
						],
						"location_index": 23,
						"id": 24,
						"description": "930 West Avenue 37, Los Angeles, CA 90065, United States"
					},
					{
						"type": "job",
						"arrival": 1696598028,
						"duration": 4607,
						"service": 120,
						"waiting_time": 2892,
						"location": [
							34.06147571,
							-118.2119934
						],
						"location_index": 21,
						"id": 22,
						"description": "1201 North Mission Road, Los Angeles, CA 90033, United States"
					},
					{
						"type": "end",
						"arrival": 1696601040,
						"duration": 4607,
						"service": 0,
						"waiting_time": 0,
						"location": [
							34.06147571,
							-118.2119934
						],
						"location_index": 21
					}
				],
				"service": 720,
				"duration": 4607,
				"waiting_time": 2892,
				"priority": 0,
				"distance": 44744.7,
				"geometry": "ys}mEffbqU?V[?Q?K?GEKGg@?_@?O?iAAkA@gA?_A@QJ_BAaA?{@A{@??BADcAjDWr@A@??"
			},
			{
				"vehicle": 15,
				"cost": 145,
				"steps": [
					{
						"type": "start",
						"arrival": 1696584215,
						"duration": 0,
						"service": 0,
						"waiting_time": 0,
						"location": [
							33.908,
							-118.309
						],
						"location_index": 26
					},
					{
						"type": "job",
						"arrival": 1696584360,
						"duration": 145,
						"service": 120,
						"waiting_time": 0,
						"location": [
							33.90365408,
							-118.3107476
						],
						"location_index": 4,
						"id": 5,
						"description": "1859 West Rosecrans Avenue, Gardena, CA 90249, United States"
					},
					{
						"type": "end",
						"arrival": 1696584480,
						"duration": 145,
						"service": 0,
						"waiting_time": 0,
						"location": [
							33.90365408,
							-118.3107476
						],
						"location_index": 4
					}
				],
				"service": 120,
				"duration": 145,
				"waiting_time": 0,
				"priority": 0,
				"distance": 987.3,
				"geometry": "ys}mEffbqU?Vf@?rA?H?fA@jA?J?\\?\\?V?Z?X?N?d@?p@?X?R?zA?lA?V?T@z@?T?T?d@?H?Z@LHB@P?b@?P?Z?X?X?N?LKT?@~@Cl@@x@?~@?X?h@M?w@?_F?EACE??"
			},
			{
				"vehicle": 8,
				"cost": 3089,
				"steps": [
					{
						"type": "start",
						"arrival": 1696598553,
						"duration": 0,
						"service": 0,
						"waiting_time": 0,
						"location": [
							33.908,
							-118.309
						],
						"location_index": 26
					},
					{
						"type": "job",
						"arrival": 1696598940,
						"duration": 387,
						"service": 120,
						"waiting_time": 0,
						"location": [
							33.93002508,
							-118.3037142
						],
						"location_index": 14,
						"id": 15,
						"description": "1509 West Imperial Highway, Los Angeles, CA 90047, United States"
					},
					{
						"type": "job",
						"arrival": 1696599294,
						"duration": 621,
						"service": 120,
						"waiting_time": 0,
						"location": [
							33.92595279,
							-118.2962582
						],
						"location_index": 10,
						"id": 11,
						"description": "11817 South Budlong Avenue, Los Angeles, CA 90044, United States"
					},
					{
						"type": "job",
						"arrival": 1696599979,
						"duration": 1186,
						"service": 120,
						"waiting_time": 0,
						"location": [
							33.96276795,
							-118.2864459
						],
						"location_index": 3,
						"id": 4,
						"description": "727 West 84th Street, Los Angeles, CA 90044, United States"
					},
					{
						"type": "job",
						"arrival": 1696600920,
						"duration": 2007,
						"service": 120,
						"waiting_time": 0,
						"location": [
							34.00942629,
							-118.3184051
						],
						"location_index": 13,
						"id": 14,
						"description": "4139 Arlington Avenue, Los Angeles, CA 90008, United States"
					},
					{
						"type": "job",
						"arrival": 1696602122,
						"duration": 3089,
						"service": 120,
						"waiting_time": 0,
						"location": [
							34.07865234,
							-118.334726
						],
						"location_index": 19,
						"id": 20,
						"description": "6176 Oakwood Avenue, Los Angeles, CA 90004, United States"
					},
					{
						"type": "end",
						"arrival": 1696602242,
						"duration": 3089,
						"service": 0,
						"waiting_time": 0,
						"location": [
							34.07865234,
							-118.334726
						],
						"location_index": 19
					}
				],
				"service": 600,
				"duration": 3089,
				"waiting_time": 0,
				"priority": 0,
				"distance": 29415.3,
				"geometry": "ys}mEffbqU?V[?Q?K?GEKGg@?_@?O?iAAkA@gA?_A@QJ_BAaA?{@A{@?WAq@@{@?q@@}ACoGEsE??"
			},
			{
				"vehicle": 24,
				"cost": 2906,
				"steps": [
					{
						"type": "start",
						"arrival": 1696584417,
						"duration": 0,
						"service": 0,
						"waiting_time": 0,
						"location": [
							33.908,
							-118.309
						],
						"location_index": 26
					},
					{
						"type": "job",
						"arrival": 1696585666,
						"duration": 1249,
						"service": 120,
						"waiting_time": 0,
						"location": [
							33.93384956,
							-118.1132939
						],
						"location_index": 11,
						"id": 12,
						"description": "10835 Casanes Avenue, Downey, CA 90241, United States"
					},
					{
						"type": "job",
						"arrival": 1696586640,
						"duration": 2103,
						"service": 120,
						"waiting_time": 0,
						"location": [
							33.98898095,
							-118.1579664
						],
						"location_index": 18,
						"id": 19,
						"description": "4593 Alexander Street, Los Angeles, CA 90040, United States"
					},
					{
						"type": "job",
						"arrival": 1696587563,
						"duration": 2906,
						"service": 120,
						"waiting_time": 1357,
						"location": [
							33.975499,
							-118.2147567
						],
						"location_index": 8,
						"id": 9,
						"description": "6939 Arbutus Avenue, Huntington Park, CA 90255, United States"
					},
					{
						"type": "end",
						"arrival": 1696589040,
						"duration": 2906,
						"service": 0,
						"waiting_time": 0,
						"location": [
							33.975499,
							-118.2147567
						],
						"location_index": 8
					}
				],
				"service": 360,
				"duration": 2906,
				"waiting_time": 1357,
				"priority": 0,
				"distance": 42075.2,
				"geometry": "ys}mEffbqU?V[?Q?K?GEKGg@?_@?O?iAAkA@gA?_A@QJ_BAaA?{@A{@?|ACGzAKxBSdErCApAA??"
			}
		]
	},
	"status": "Ok",
	"message": ""
}

Accessing Optimized Routes in NextBillion.ai’s Optimizer

To visualize and analyze the optimized routes generated by NextBillion's Optimizer, you can use the following URL.

https://playground.nextbillion.ai/optimization-tester?apiKey={{localStorage.values.apiKey}}&requestID={{nbaiOptimizationRun.data.id}}

The above URL will take you to NextBillion's Optimizer interface where you can explore and interact with the optimized route results associated with your specific request ID and API key. This provides a convenient way to gain insights into your optimized routes for enhanced decision-making and resource management.

docs-image