You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: backend/API_DOC.md
+34-21Lines changed: 34 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,19 @@ Vehicle routing backend API built with Django. All endpoints return JSON data.
7
7
http://localhost:8000/api/
8
8
```
9
9
10
+
## Root Endpoint
11
+
**GET**`/`
12
+
13
+
Basic status endpoint that returns API information.
14
+
15
+
Response:
16
+
```json
17
+
{
18
+
"status": "ok",
19
+
"message": "Welcome to Dashmap!"
20
+
}
21
+
```
22
+
10
23
## Authentication
11
24
API uses token-based authentication. All endpoints (except login) require a valid authentication token.
12
25
@@ -316,7 +329,7 @@ All list endpoints return data in this format:
316
329
"contact_phone": "555-0001",
317
330
"notes": "Use rear entrance"
318
331
},
319
-
"order": 1,
332
+
"sequence": 1,
320
333
"planned_arrival_time": "09:00:00",
321
334
"actual_arrival_datetime": null,
322
335
"actual_departure_datetime": null,
@@ -352,7 +365,7 @@ Includes all above fields plus:
352
365
"contact_phone": "555-0001",
353
366
"notes": "Use rear entrance"
354
367
},
355
-
"order": 1,
368
+
"sequence": 1,
356
369
"planned_arrival_time": "09:00:00",
357
370
"actual_arrival_datetime": null,
358
371
"actual_departure_datetime": null,
@@ -402,7 +415,7 @@ Includes all above fields plus:
402
415
"longitude": "-87.629799",
403
416
"stop_type": "pickup"
404
417
},
405
-
"order": 1,
418
+
"sequence": 1,
406
419
"planned_arrival_time": "09:00:00",
407
420
"actual_arrival_datetime": null,
408
421
"actual_departure_datetime": null,
@@ -424,14 +437,14 @@ The `linked_order` field contains the order that uses this stop as either a pick
424
437
425
438
The field will be `null` if no order is associated with the stop.
426
439
427
-
#### Trip Stop Order Management
440
+
#### Trip Stop Sequence Management
428
441
429
-
**Creating Trip Stops with Order Conflicts:**
430
-
When creating a trip stop with an order that already exists, the system automatically shifts existing stops to higher order numbers to make room for the new stop.
442
+
**Creating Trip Stops with Sequence Conflicts:**
443
+
When creating a trip stop with a sequence that already exists, the system automatically shifts existing stops to higher sequence numbers to make room for the new stop.
431
444
432
-
Example: If a trip has stops with orders[1, 2, 3] and you create a new stop with order=2, the result will be:
433
-
- New stop: order=2
434
-
- Existing stops: orders[1, 3, 4] (original order=2 and order=3 are shifted up)
445
+
Example: If a trip has stops with sequences[1, 2, 3] and you create a new stop with sequence=2, the result will be:
446
+
- New stop: sequence=2
447
+
- Existing stops: sequences[1, 3, 4] (original sequence=2 and sequence=3 are shifted up)
435
448
436
449
#### Order Completeness Validation
437
450
@@ -463,7 +476,7 @@ Trips must contain complete order journeys (both pickup and delivery stops). Thi
463
476
Request:
464
477
```json
465
478
{
466
-
"order": 1,
479
+
"sequence": 1,
467
480
"pickup_time": "09:00:00",
468
481
"delivery_time": "14:00:00",
469
482
"notes": "Handle with care"
@@ -476,7 +489,7 @@ Response:
476
489
"message": "Successfully added order ORD-2024-0001 to trip",
477
490
"pickup_trip_stop": {
478
491
"id": 15,
479
-
"order": 3,
492
+
"sequence": 3,
480
493
"planned_arrival_time": "09:00:00",
481
494
"stop": {
482
495
"id": 10,
@@ -486,7 +499,7 @@ Response:
486
499
},
487
500
"delivery_trip_stop": {
488
501
"id": 16,
489
-
"order": 4,
502
+
"sequence": 4,
490
503
"planned_arrival_time": "14:00:00",
491
504
"stop": {
492
505
"id": 11,
@@ -498,23 +511,23 @@ Response:
498
511
```
499
512
500
513
**Deleting Trip Stops:**
501
-
When a trip stop is deleted, remaining stops with higher order numbers are automatically shifted down to close gaps and maintain consecutive ordering.
514
+
When a trip stop is deleted, remaining stops with higher sequence numbers are automatically shifted down to close gaps and maintain consecutive sequencing.
502
515
503
-
Example: If a trip has stops with orders[1, 2, 3] and you delete the stop with order=2, the result will be:
504
-
- Remaining stops: orders[1, 2] (original order=3 is shifted down to order=2)
516
+
Example: If a trip has stops with sequences[1, 2, 3] and you delete the stop with sequence=2, the result will be:
517
+
- Remaining stops: sequences[1, 2] (original sequence=3 is shifted down to sequence=2)
505
518
506
519
**Bulk Reordering:**
507
-
Use the reorder endpoint to update multiple trip stop orders in a single transaction.
520
+
Use the reorder endpoint to update multiple trip stop sequences in a single transaction.
508
521
509
522
**POST**`/api/trips/{trip_id}/reorder-stops/`
510
523
511
524
Request:
512
525
```json
513
526
{
514
527
"orders": [
515
-
{"id": 10, "order": 1},
516
-
{"id": 11, "order": 2},
517
-
{"id": 12, "order": 3}
528
+
{"id": 10, "sequence": 1},
529
+
{"id": 11, "sequence": 2},
530
+
{"id": 12, "sequence": 3}
518
531
]
519
532
}
520
533
```
@@ -527,7 +540,7 @@ Response:
527
540
"id": 10,
528
541
"trip": 5,
529
542
"stop": {...},
530
-
"order": 1,
543
+
"sequence": 1,
531
544
"planned_arrival_time": "09:00:00",
532
545
"actual_arrival_datetime": null,
533
546
"actual_departure_datetime": null,
@@ -538,7 +551,7 @@ Response:
538
551
}
539
552
```
540
553
541
-
All trip stop IDs in the request must belong to the specified trip. The response returns all trip stops for the trip in their new order.
554
+
All trip stop IDs in the request must belong to the specified trip. The response returns all trip stops for the trip in their new sequence.
0 commit comments