-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi-endpoints.http
More file actions
1178 lines (972 loc) · 33.6 KB
/
api-endpoints.http
File metadata and controls
1178 lines (972 loc) · 33.6 KB
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
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
###############################################################################
# OurBusWay API Endpoints - Complete Documentation
# Frontend Requirements Analysis
# Base URL: http://localhost:8080
###############################################################################
###############################################################################
# AUTHENTICATION & ACCOUNT MANAGEMENT
###############################################################################
### Login - POST
# Endpoint for user authentication
# Request Body: { username: string, password: string }
# Response: { access_token: string }
POST http://localhost:8080/authMgtApi/login
Content-Type: application/json
{
"username": "user@example.com",
"password": "password123"
}
### Register User - POST
# Endpoint for new user registration
# Request Body: User registration details
# Response: User created (redirect to login)
POST http://localhost:8080/authMgtApi/users/register
Content-Type: application/json
{
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"mobile": "+212612345678",
"password": "securePassword123",
"dateOfBirth": "1990-01-15",
"gender": "Male",
"address": "123 Main Street, Rabat"
}
### Validate Account - POST
# Endpoint for account activation via email token
# Request Body: { activationKey: string }
# Response: 204 No Content on success
POST http://localhost:8080/authMgtApi/validate-account
Content-Type: application/json
{
"activationKey": "activation-token-from-email"
}
### Forgot Password - POST (Placeholder)
# Endpoint for password reset request
POST http://localhost:8080/authMgtApi/forgot-password
Content-Type: application/json
{
"email": "user@example.com"
}
###############################################################################
# ADMIN DASHBOARD ENDPOINTS
###############################################################################
# Overview Page
### Get System Statistics - GET
# Dashboard overview statistics
# Response: { totalUsers, ticketsSoldToday, activeBuses, revenueToday }
GET http://localhost:8080/api/admin/statistics/overview
Authorization: Bearer {{access_token}}
### Get Active Routes Summary - GET
# List of active routes with basic info
# Response: Array of routes with { id, name, number, stations, buses, status }
GET http://localhost:8080/api/admin/routes?status=active
Authorization: Bearer {{access_token}}
### Get Recent Incidents - GET
# List of recent incidents for overview
# Response: Array of incidents with status
GET http://localhost:8080/api/admin/incidents?status=open&limit=5
Authorization: Bearer {{access_token}}
# Users Management
### Get All Users - GET
# Retrieve all users with optional filters
# Query params: ?role=passenger&status=active&search=Ahmed
# Response: Array of User objects
GET http://localhost:8080/api/admin/users
Authorization: Bearer {{access_token}}
### Get All Users with Filters - GET
# Filter users by role, status, or search term
GET http://localhost:8080/api/admin/users?role=passenger&status=active&search=Ahmed
Authorization: Bearer {{access_token}}
### Get User by ID - GET
# Retrieve specific user details
GET http://localhost:8080/api/admin/users/1
Authorization: Bearer {{access_token}}
### Create User - POST
# Admin creates a new user
POST http://localhost:8080/api/admin/users
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"name": "New User",
"email": "newuser@example.com",
"role": "passenger",
"password": "password123",
"mobile": "+212612345678",
"address": "123 Street",
"dateOfBirth": "1995-05-15",
"gender": "Male"
}
### Update User - PUT
# Update user information
PUT http://localhost:8080/api/admin/users/1
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"name": "Updated Name",
"email": "updated@example.com",
"status": "active",
"role": "driver"
}
### Delete User - DELETE
# Delete/deactivate a user
DELETE http://localhost:8080/api/admin/users/1
Authorization: Bearer {{access_token}}
### Update User Status - PATCH
# Activate or deactivate user
PATCH http://localhost:8080/api/admin/users/1/status
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"status": "inactive"
}
# Tickets & Subscriptions Management
### Get Tickets Statistics - GET
# Get ticket sales and subscription statistics
# Response: { ticketsSoldToday, activeSubscriptions, revenueToday, fraudAlerts }
GET http://localhost:8080/api/admin/tickets/statistics
Authorization: Bearer {{access_token}}
### Get Revenue Analytics - GET
# Detailed revenue breakdown by ticket type
# Response: { singleTickets, monthlySubscriptions, annualSubscriptions }
GET http://localhost:8080/api/admin/tickets/revenue-analytics
Authorization: Bearer {{access_token}}
### Get All Tickets - GET
# List all tickets with filters
# Query params: ?status=active&type=single&date=2025-10-28
GET http://localhost:8080/api/admin/tickets?status=active&type=single
Authorization: Bearer {{access_token}}
### Get All Subscriptions - GET
# List all subscriptions
# Query params: ?status=active&type=monthly
GET http://localhost:8080/api/admin/subscriptions?status=active&type=monthly
Authorization: Bearer {{access_token}}
### Get Fraud Alerts - GET
# List of fraud detection alerts
GET http://localhost:8080/api/admin/tickets/fraud-alerts
Authorization: Bearer {{access_token}}
### Export Revenue Report - GET
# Download revenue report
# Response: File download (CSV/PDF)
GET http://localhost:8080/api/admin/tickets/revenue-report?format=csv
Authorization: Bearer {{access_token}}
# Routes & Schedules Management
### Get All Routes - GET
# List all routes with full details
# Response: Array of Route objects with stations, buses, schedules
GET http://localhost:8080/api/admin/routes
Authorization: Bearer {{access_token}}
### Get Route by ID - GET
# Get detailed route information including stations list
GET http://localhost:8080/api/admin/routes/1
Authorization: Bearer {{access_token}}
### Create Route - POST
# Create a new bus route with detailed information
# stationsList: Array of stations with name, order, lat/lng coordinates
# Stations must be on actual roads (verified coordinates)
# order: Sequential order starting from 0 for departure station
POST http://localhost:8080/api/admin/routes
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"name": "Ligne Agdal-Océan",
"number": "15",
"startPoint": "Agdal",
"endPoint": "Océan (Plage de Rabat)",
"avgDuration": "45 min",
"frequency": "Toutes les 15 min",
"distance": 12.5,
"status": "active",
"buses": 8,
"stationsList": [
{ "name": "Agdal", "order": 0, "latitude": 33.9716, "longitude": -6.8498 },
{ "name": "Hay Riad", "order": 1, "latitude": 33.9811, "longitude": -6.8557 },
{ "name": "Place Pietri", "order": 2, "latitude": 33.9947, "longitude": -6.8651 },
{ "name": "Bab El Had", "order": 3, "latitude": 34.0017, "longitude": -6.8698 },
{ "name": "Océan (Plage de Rabat)", "order": 4, "latitude": 34.0158, "longitude": -6.8521 }
]
}
### Update Route - PUT
# Update existing route information
PUT http://localhost:8080/api/admin/routes/1
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"name": "Ligne Agdal-Océan Updated",
"number": "15",
"startPoint": "Agdal",
"endPoint": "Océan",
"avgDuration": "50 min",
"frequency": "Toutes les 12 min",
"status": "active",
"stationsList": [
{ "id": "s1", "name": "Agdal", "order": 0 },
{ "id": "s2", "name": "Hay Riad", "order": 1 }
]
}
### Delete Route - DELETE
# Delete a route
DELETE http://localhost:8080/api/admin/routes/1
Authorization: Bearer {{access_token}}
### Update Route Status - PATCH
# Change route status (active/inactive/maintenance)
PATCH http://localhost:8080/api/admin/routes/1/status
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"status": "maintenance"
}
### Get Route Statistics - GET
# Get performance statistics for a specific route
# Response includes detailed metrics:
# {
# "occupancy": 78, // % of bus capacity filled
# "onTime": 92, // % of trips on time
# "passengers": 1847, // Daily passenger count
# "revenue": 4523, // Daily revenue in currency
# "avgDuration": "45 min",
# "frequency": "Every 15 min"
# }
GET http://localhost:8080/api/admin/routes/1/statistics
Authorization: Bearer {{access_token}}
### Assign Bus to Route - POST
# Assign a bus to a specific route
POST http://localhost:8080/api/admin/routes/1/buses
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"busId": "BUS-101",
"driverId": "2"
}
### Get Route Schedules - GET
# Get schedule information for a route
GET http://localhost:8080/api/admin/routes/1/schedules
Authorization: Bearer {{access_token}}
### Update Route Schedule - PUT
# Update schedule for a route
PUT http://localhost:8080/api/admin/routes/1/schedules
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"schedules": [
{ "departureTime": "06:00", "frequency": "15 min" },
{ "departureTime": "08:00", "frequency": "10 min" }
]
}
# Geolocation & Bus Tracking
### Get All Buses - GET
# List all buses with current location and real-time info
# Response includes: id, number, route, routeName, driver, status, location, speed, passengers
# Example:
# [
# {
# id: "1", number: "BUS-101", route: "15", routeName: "Ligne Agdal-Océan",
# driver: "Hiba EL OUERKHAOUI", status: "active",
# location: { lat: 33.9947, lng: -6.8651 },
# speed: 45, passengers: 32
# }
# ]
GET http://localhost:8080/api/admin/buses
Authorization: Bearer {{access_token}}
### Get Bus Location - GET
# Get real-time location of a specific bus
GET http://localhost:8080/api/admin/buses/BUS-101/location
Authorization: Bearer {{access_token}}
### Get Buses by Route - GET
# Get all buses assigned to a specific route
GET http://localhost:8080/api/admin/routes/15/buses
Authorization: Bearer {{access_token}}
### Get Bus Fleet Statistics - GET
# Statistics about bus fleet status
# Response: { activeBuses, inMaintenance, totalBuses }
GET http://localhost:8080/api/admin/buses/statistics
Authorization: Bearer {{access_token}}
### Update Bus Status - PATCH
# Update bus operational status
PATCH http://localhost:8080/api/admin/buses/BUS-101/status
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"status": "maintenance"
}
### Get Route Trajectory - GET
# Get route path coordinates for map display (following actual roads)
# Response: Array of [latitude, longitude] coordinate pairs
# Can fetch from OSRM API or use pre-computed paths
# Example: [[33.9716, -6.8498], [33.9745, -6.8512], ...]
GET http://localhost:8080/api/admin/routes/15/trajectory
Authorization: Bearer {{access_token}}
### Get Route Trajectory from OSRM (External API) - GET
# Fetch real-time road route between coordinates
# Free API, no authentication needed
# Format: lng,lat;lng,lat;lng,lat
GET https://router.project-osrm.org/route/v1/driving/-6.8498,33.9716;-6.8557,33.9811;-6.8651,33.9947?overview=full&geometries=geojson
### Get Stations by Route - GET
# Get all stations for a specific route with coordinates
# Response includes: id, name, latitude, longitude, order, route
# Example:
# [
# { id: "s1", name: "Agdal", lat: 33.9716, lng: -6.8498, route: "15", order: 0 },
# { id: "s2", name: "Hay Riad", lat: 33.9811, lng: -6.8557, route: "15", order: 1 }
# ]
GET http://localhost:8080/api/admin/routes/15/stations
Authorization: Bearer {{access_token}}
# Incidents Management
### Get All Incidents - GET
# List all incidents with filters
# Query params: ?status=open&severity=high&routeId=1
GET http://localhost:8080/api/admin/incidents?status=open&severity=high
Authorization: Bearer {{access_token}}
### Get Incident by ID - GET
# Get specific incident details
GET http://localhost:8080/api/admin/incidents/1
Authorization: Bearer {{access_token}}
### Create Incident - POST
# Report a new incident (typically from driver)
POST http://localhost:8080/api/admin/incidents
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"type": "delay",
"tripId": "TR001",
"routeName": "Line 15",
"description": "Heavy traffic on main boulevard",
"reportedBy": "Karim Benali",
"severity": "medium"
}
### Update Incident - PUT
# Update incident information
PUT http://localhost:8080/api/admin/incidents/1
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"status": "resolved",
"resolution": "Traffic cleared, normal service resumed"
}
### Resolve Incident - PATCH
# Mark incident as resolved
PATCH http://localhost:8080/api/admin/incidents/1/resolve
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"resolution": "Issue fixed"
}
### Delete Incident - DELETE
# Delete an incident record
DELETE http://localhost:8080/api/admin/incidents/1
Authorization: Bearer {{access_token}}
### Get Incidents Statistics - GET
# Get incident statistics
# Response: { openIncidents, resolvedToday, totalIncidents }
GET http://localhost:8080/api/admin/incidents/statistics
Authorization: Bearer {{access_token}}
# Notifications Management
### Get All Notifications - GET
# List all system notifications
GET http://localhost:8080/api/admin/notifications
Authorization: Bearer {{access_token}}
### Get Notification History - GET
# Get sent notification history with delivery stats
GET http://localhost:8080/api/admin/notifications/history?limit=10
Authorization: Bearer {{access_token}}
### Send Mass Notification - POST
# Send notification to multiple users
POST http://localhost:8080/api/admin/notifications/mass
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"type": "delay",
"title": "Line 15 Delay Alert",
"message": "Line 15 buses are experiencing 15-minute delays due to road construction.",
"targetAudience": "route-specific",
"routeId": "15",
"priority": "high",
"channels": ["email", "sms", "push"]
}
### Send Email Notification - POST
# Send notification via email
POST http://localhost:8080/api/admin/notifications/email
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"recipients": ["all-passengers"],
"subject": "Service Update",
"message": "Important service update message",
"type": "service"
}
### Send SMS Notification - POST
# Send notification via SMS
POST http://localhost:8080/api/admin/notifications/sms
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"recipients": ["route-15-subscribers"],
"message": "Line 15 delayed by 10 minutes"
}
### Delete Notification - DELETE
# Delete a notification
DELETE http://localhost:8080/api/admin/notifications/1
Authorization: Bearer {{access_token}}
###############################################################################
# PASSENGER DASHBOARD ENDPOINTS
###############################################################################
# Tickets Management
### Get My Tickets - GET
# Get all tickets for logged-in passenger
# Query params: ?status=active
GET http://localhost:8080/api/passenger/tickets?status=active
Authorization: Bearer {{access_token}}
### Get Ticket by ID - GET
# Get specific ticket details with QR code
GET http://localhost:8080/api/passenger/tickets/1
Authorization: Bearer {{access_token}}
### Buy Single Ticket - POST
# Purchase a single bus ticket
POST http://localhost:8080/api/passenger/tickets/buy
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"type": "single",
"routeId": "15",
"departureStation": "Rabat Ville",
"arrivalStation": "Agdal",
"price": 20.0,
"paymentMethod": "credit_card"
}
### Search Tickets - POST
# Search available tickets/routes between stations
# Returns suggestions with route, duration, connections, price
# Available stations: Sidi Yaacoub, Manssour, Rabat Ville, Agdal, Salé,
# Youssoufia, Temara, Akkari, Hay Riad, Oudayas
POST http://localhost:8080/api/passenger/tickets/search
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"departure": "Rabat Ville",
"arrival": "Agdal",
"date": "2025-10-28"
}
### Search Tickets Response Example
# Response structure:
# {
# "results": [
# {
# "departure": "Rabat Ville",
# "arrival": "Agdal",
# "duration": "45 min",
# "connections": 1,
# "trainType": "Express",
# "departureStation": "Rabat Ville",
# "arrivalStation": "Agdal",
# "price": 20.0,
# "currency": "DH",
# "intermediateStations": [
# { "time": "08:00", "station": "Manssour", "trainType": "Local" }
# ]
# }
# ]
# }
### Validate Ticket - GET
# Validate ticket (for QR display)
GET http://localhost:8080/api/passenger/tickets/1/validate
Authorization: Bearer {{access_token}}
# Subscriptions Management
### Get My Subscriptions - GET
# Get all subscriptions for logged-in passenger
# Response: Array of Subscription objects
# Example:
# [
# {
# id: "1", type: "monthly", passengerType: "student", status: "active",
# startDate: "2025-10-01T00:00:00", endDate: "2025-10-31T23:59:59",
# price: 50.0, autoRenew: true, subscriptionId: "SUB-2025-4782",
# routeCoverage: "All Routes"
# }
# ]
GET http://localhost:8080/api/passenger/subscriptions
Authorization: Bearer {{access_token}}
### Get Subscription by ID - GET
# Get specific subscription details including subscriptionId and routeCoverage
GET http://localhost:8080/api/passenger/subscriptions/1
Authorization: Bearer {{access_token}}
### Get Available Subscription Plans - GET
# Get all available subscription types and pricing
# Response: Array of subscription plans with passenger types
# passengerType: "student" | "young" | "elder" | "standard"
# type: "monthly" | "annual"
# Example response:
# [
# { type: "monthly", passengerType: "student", price: 50, benefits: [...] },
# { type: "monthly", passengerType: "young", price: 70, benefits: [...] },
# { type: "monthly", passengerType: "elder", price: 60, benefits: [...] },
# { type: "monthly", passengerType: "standard", price: 100, benefits: [...] }
# ]
GET http://localhost:8080/api/passenger/subscriptions/plans
Authorization: Bearer {{access_token}}
### Purchase Subscription - POST
# Buy a new subscription
# passengerType options: "student" | "young" | "elder" | "standard"
# type options: "monthly" | "annual"
POST http://localhost:8080/api/passenger/subscriptions/purchase
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"type": "monthly",
"passengerType": "student",
"routeCoverage": "all",
"autoRenew": true,
"paymentMethod": "credit_card"
}
### Renew Subscription - POST
# Renew existing subscription
POST http://localhost:8080/api/passenger/subscriptions/1/renew
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"autoRenew": true
}
### Update Auto-Renewal - PATCH
# Enable/disable auto-renewal
PATCH http://localhost:8080/api/passenger/subscriptions/1/auto-renew
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"autoRenew": false
}
### Get Subscription Receipts - GET
# Get payment receipts for subscription
GET http://localhost:8080/api/passenger/subscriptions/1/receipts
Authorization: Bearer {{access_token}}
### Cancel Subscription - DELETE
# Cancel an active subscription
DELETE http://localhost:8080/api/passenger/subscriptions/1
Authorization: Bearer {{access_token}}
# Routes & Trips
### Get All Routes - GET
# Get all available bus routes and schedules
GET http://localhost:8080/api/passenger/routes
Authorization: Bearer {{access_token}}
### Get Route Details - GET
# Get detailed route information
GET http://localhost:8080/api/passenger/routes/15
Authorization: Bearer {{access_token}}
### Get Route Trips - GET
# Get scheduled trips for a route
# Query params: ?date=2025-10-28
GET http://localhost:8080/api/passenger/routes/15/trips?date=2025-10-28
Authorization: Bearer {{access_token}}
### Get Trip Details - GET
# Get real-time trip information
GET http://localhost:8080/api/passenger/trips/1
Authorization: Bearer {{access_token}}
### Get Trip Location - GET
# Get real-time bus location for a trip
GET http://localhost:8080/api/passenger/trips/1/location
Authorization: Bearer {{access_token}}
### Search Routes - POST
# Search for routes between stations
POST http://localhost:8080/api/passenger/routes/search
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"departure": "Sidi Yaacoub",
"arrival": "Agdal"
}
### Add Favorite Route - POST
# Add route to favorites
POST http://localhost:8080/api/passenger/routes/15/favorite
Authorization: Bearer {{access_token}}
### Remove Favorite Route - DELETE
# Remove route from favorites
DELETE http://localhost:8080/api/passenger/routes/15/favorite
Authorization: Bearer {{access_token}}
### Get Favorite Routes - GET
# Get user's favorite routes
GET http://localhost:8080/api/passenger/favorites
Authorization: Bearer {{access_token}}
# Profile Management
### Get My Profile - GET
# Get logged-in user profile
GET http://localhost:8080/api/passenger/profile
Authorization: Bearer {{access_token}}
### Update Profile - PUT
# Update user profile information
PUT http://localhost:8080/api/passenger/profile
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"name": "Abderrahmane Essahih",
"email": "abderrahmane.essahih@example.com",
"mobile": "+212612345678",
"address": "123 New Address"
}
### Change Password - POST
# Change user password
POST http://localhost:8080/api/passenger/profile/change-password
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"currentPassword": "oldPassword123",
"newPassword": "newPassword456"
}
### Upload Avatar - POST
# Upload profile picture
POST http://localhost:8080/api/passenger/profile/avatar
Authorization: Bearer {{access_token}}
Content-Type: multipart/form-data
# Form data with image file
# Notifications
### Get My Notifications - GET
# Get notifications for logged-in passenger
# Query params: ?read=false
GET http://localhost:8080/api/passenger/notifications?read=false
Authorization: Bearer {{access_token}}
### Mark Notification as Read - PATCH
# Mark specific notification as read
PATCH http://localhost:8080/api/passenger/notifications/1/read
Authorization: Bearer {{access_token}}
### Mark All Notifications as Read - PATCH
# Mark all notifications as read
PATCH http://localhost:8080/api/passenger/notifications/read-all
Authorization: Bearer {{access_token}}
### Delete Notification - DELETE
# Delete a notification
DELETE http://localhost:8080/api/passenger/notifications/1
Authorization: Bearer {{access_token}}
### Get Unread Count - GET
# Get count of unread notifications
GET http://localhost:8080/api/passenger/notifications/unread-count
Authorization: Bearer {{access_token}}
###############################################################################
# DRIVER DASHBOARD ENDPOINTS
###############################################################################
# Trips & Schedule Management
### Get My Trips - GET
# Get all trips assigned to driver
# Query params: ?date=2025-10-28&status=scheduled
GET http://localhost:8080/api/driver/trips?date=2025-10-28&status=scheduled
Authorization: Bearer {{access_token}}
### Get Trip Details - GET
# Get specific trip details
GET http://localhost:8080/api/driver/trips/1
Authorization: Bearer {{access_token}}
### Get Today's Trips - GET
# Get trips scheduled for today
GET http://localhost:8080/api/driver/trips/today
Authorization: Bearer {{access_token}}
### Start Trip - POST
# Start a scheduled trip
POST http://localhost:8080/api/driver/trips/1/start
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"startTime": "2025-10-28T14:00:00",
"initialLocation": {
"latitude": 33.9716,
"longitude": -6.8498
}
}
### End Trip - POST
# Complete an in-progress trip
POST http://localhost:8080/api/driver/trips/1/end
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"endTime": "2025-10-28T14:45:00",
"finalLocation": {
"latitude": 34.0158,
"longitude": -6.8521
},
"totalPassengers": 45
}
### Update Trip Status - PATCH
# Update trip status
PATCH http://localhost:8080/api/driver/trips/1/status
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"status": "delayed",
"reason": "Heavy traffic"
}
# Geolocation
### Update Bus Location - POST
# Send real-time GPS location update
# Should be called every 3-5 seconds for smooth tracking
# speed: in km/h
# heading: in degrees (0-360, 0=North, 90=East, 180=South, 270=West)
# passengers: current passenger count on bus
POST http://localhost:8080/api/driver/location
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"busId": "BUS-101",
"latitude": 33.9947,
"longitude": -6.8651,
"speed": 45,
"heading": 180,
"passengers": 32,
"timestamp": "2025-10-28T14:23:00"
}
### Start Location Sharing - POST
# Enable location sharing for trip
POST http://localhost:8080/api/driver/location/start-sharing
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"tripId": "1",
"busId": "BUS-101"
}
### Stop Location Sharing - POST
# Disable location sharing
POST http://localhost:8080/api/driver/location/stop-sharing
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"tripId": "1"
}
### Get Location Sharing Status - GET
# Check if location sharing is active
GET http://localhost:8080/api/driver/location/status
Authorization: Bearer {{access_token}}
# Incidents Management
### Report Incident - POST
# Report an incident during trip
POST http://localhost:8080/api/driver/incidents
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"type": "delay",
"tripId": "1",
"routeName": "Line 15",
"description": "Heavy traffic on main boulevard",
"severity": "medium",
"location": {
"latitude": 33.9947,
"longitude": -6.8651
}
}
### Get My Incidents - GET
# Get all incidents reported by driver
GET http://localhost:8080/api/driver/incidents
Authorization: Bearer {{access_token}}
### Update Incident - PUT
# Update incident status/details
PUT http://localhost:8080/api/driver/incidents/1
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"status": "resolved",
"notes": "Issue has been resolved"
}
# Planning & History
### Get Driver Statistics - GET
# Get driver performance statistics
# Response: { tripsThisWeek, onTimeRate, totalTrips }
GET http://localhost:8080/api/driver/statistics
Authorization: Bearer {{access_token}}
### Get Trip History - GET
# Get completed trips history
# Query params: ?startDate=2025-10-01&endDate=2025-10-31
GET http://localhost:8080/api/driver/trips/history?startDate=2025-10-01&endDate=2025-10-31
Authorization: Bearer {{access_token}}
### Get Route Assignment - GET
# Get currently assigned route
GET http://localhost:8080/api/driver/route-assignment
Authorization: Bearer {{access_token}}
# Notifications
### Get Driver Notifications - GET
# Get notifications specific to driver
GET http://localhost:8080/api/driver/notifications
Authorization: Bearer {{access_token}}
###############################################################################
# CONTROLLER DASHBOARD ENDPOINTS
###############################################################################
# Ticket Validation
### Validate Ticket by QR - POST
# Scan and validate passenger ticket
POST http://localhost:8080/api/controller/validate-ticket
Authorization: Bearer {{access_token}}
Content-Type: application/json
{
"qrCode": "QR123456789",
"tripId": "TR001",
"scannedAt": "2025-10-28T14:23:00",
"location": {
"latitude": 33.9947,
"longitude": -6.8651
}
}
### Get Validation Result - GET
# Get validation result for a ticket
GET http://localhost:8080/api/controller/validate-ticket/QR123456789
Authorization: Bearer {{access_token}}
### Get Validation Statistics - GET
# Get today's validation statistics
# Response: { validTickets, invalidTickets, totalScans, validationRate }
GET http://localhost:8080/api/controller/statistics/today
Authorization: Bearer {{access_token}}
### Get Recent Validations - GET
# Get recent validation records
GET http://localhost:8080/api/controller/validations/recent?limit=10
Authorization: Bearer {{access_token}}
# Passenger Inspection
### Search Passenger - GET
# Search passenger by ticket ID or name
# Query params: ?query=Ahmed
GET http://localhost:8080/api/controller/passengers/search?query=Ahmed
Authorization: Bearer {{access_token}}
### Get Passenger Details - GET
# Get passenger information by ID
GET http://localhost:8080/api/controller/passengers/P001
Authorization: Bearer {{access_token}}
### Get Passenger Tickets - GET
# Get all tickets for a passenger
GET http://localhost:8080/api/controller/passengers/P001/tickets
Authorization: Bearer {{access_token}}
### Report Fraud - POST
# Report fraudulent ticket or passenger
POST http://localhost:8080/api/controller/report-fraud
Authorization: Bearer {{access_token}}
Content-Type: application/json