---
title: Transit V2 API
tags: Transit, API
description: Transit V2 API Info
---
# Transit V2 API
---
This the Documentation for the new API
---
## JSON Data Objects for Phase 1
### Bus
```json=
{
'bus_ID': Int,
'trip_ID': Int,
'GPS_ID': Int,
'location':
{
'lat': Float,
'long': Float
},
'status': String
}
```
### ROUTES
```json=
{
'route_ID': Int,
'trip_ID': Int,
'bus_ID': Int
}
```
---
## GTFS Data Objects Used to Handle Static Data
### AGENCY
```json=
{
'id': String, // DB identifier
'agency_id': String,
'agency_name': String,
'agency_url': String,
'agency_timezone': String,
'agency_lang': String,
'agency_phone': String,
'agency_fare_url': String,
'agency_email': String
}
```
### CALENDAR
```json=
{
'id': String, // DB identifier
'agency_id': String,
'service_id': String,
'monday': Int,
'tuesday': Int,
'wednesday': Int,
'thursday': Int,
'friday': Int,
'saturday': Int,
'sunday': Int,
'start_date': Date,
'end_date': Date
}
```
### ROUTE
```json=
{
'id': String, // DB identifier
'agency_id': String,
'route_id': String,
'route_short_name': String,
'route_long_name': String,
'route_desc': String,
'route_type': Int,
'route_url': String,
'route_color': String,
'route_text_color': String
}
```
### STOP
```json=
{
'id': String, // DB identifier
'agency_id': String,
'stop_id': String,
'stop_code': String,
'stop_name': String,
'stop_desc': String,
'stop_lat': Double,
'stop_lon': Double,
'zone_id': String,
'location_type': Int,
'parent_station': String,
'stop_timezone': String,
'wheelchair_boarding': Int
}
```
### STOP_TIME
```json=
{
'id': String, // DB identifier
'agency_id': String,
'trip_id': String,
'arrival_time': Date,
'departure_time': Date,
'stop_id': String,
'stop_sequence': Int,
'pickup_type': Int,
'drop_off_type': Int,
'shape_dist_traveled': String,
'stop_headsign': String,
'timepoint': Int
}
```
### TRIP
```json=
{
'id': String, // DB identifier
'agency_id': String,
'route_id': String,
'service_id': String,
'trip_id': String,
'trip_headsign': String,
'trip_short_name': String,
'direction_id': Int,
'block_id': String,
'shape_id': String,
'wheelchair_accessible': Int,
'bikes_allowed': Int
}
```
---
## AUTH
### USERS
```json=
{
'email': String,
'password': String,
'favorites': Array (Route ID's),
'name':{
'firstName': String,
'lastName': String
}
}
```
### DISPATCHER
```json=
{
'email': String,
'password': String,
'name':{
'firstName': String,
'lastName': String
}
}
```
### ADMIN
```json=
{
'email': String,
'password': String,
}
```
---
## ROUTES
### BUSES
#### GET
- <code class="green">GET</code> /api/buses/
```json=
{
[
{
JSON Object Array of All Buses
}
]
}
```
<br>
- <code class="green">GET</code> /api/buses/:id
```json=
{
'bus_ID': Int,
'trip_ID': Int,
'GPS_ID': Int,
'location':
{
'lat': Float,
'long': Float
},
'status': String
}
```
<br>
- <code class="green">GET</code> /api/buses?route=routeId
```json=
{
'bus_ID': Int,
'trip_ID': Int,
'GPS_ID': Int,
'location':
{
'lat': Float,
'long': Float
},
'status': String
}
```
<br>
- <code class="green">GET</code> /api/buses?status=String
```json=
{
{
'bus_ID': Int,
'trip_ID': Int,
'GPS_ID': Int,
'location':
{
'lat': Float,
'long': Float
},
'status': String
}
}
```
#### POST (ADMIN ONLY)
- <code class="blue">POST</code> /api/buses/
```json=
{
{
'bus_ID': Int,
'trip_ID': Int,
'GPS_ID': Int,
'location':
{
'lat': Float,
'long': Float
},
'status': String
}
}
```
#### UPDATE (ADMIN ONLY)
- <code class="purple">PATCH BY ID</code> /api/buses/:id
```json=
{
{
'bus_ID': Int,
'trip_ID': Int,
'GPS_ID': Int,
'location':
{
'lat': Float,
'long': Float
},
'status': String
}
}
```
#### DELETE (ADMIN ONLY)
- <code class="red">DELETE BY ID</code> /api/buses/:id
```json=
{
Successful!
or
Not successful!
}
```
<br>
### ROUTES
#### GET
- <code class="green">GET</code> /api/routes/
```json=
{
[
{
JSON Object Array of All Bus Routes
}
]
}
```
<br>
- <code class="green">GET BY ID</code> /api/routes/:id
```json=
{
'route_No': Int,
'trip_ID': Int,
'bus_ID': Int
}
```
#### POST (ADMIN ONLY)
- <code class="blue">POST BY ID</code> /api/routes/
```json=
{
'route_No': Int,
'trip_ID': Int,
'bus_ID': Int
}
```
#### UPDATE (ADMIN ONLY)
- <code class="purple">Patch BY ID</code> /api/routes/:id
```json=
{
'route_No': Int,
'trip_ID': Int,
'bus_ID': Int
}
```
#### DELETE (ADMIN ONLY)
- <code class="red">DELETE BY ID</code> /api/routes/:id
```json=
{
Successful!
or
Not successful!
}
```
<br>
### USERS
- <code class="green">GET BY USER ID</code> /api/users/:id
```json=
{
'email': String,
'password': empty,
'favorites': Json Object Array List,
'name':{
'firstName': String,
'lastName': String
}
}
```
<br>
- <code class="blue">POST USER</code> /api/users/
```json=
{
'email': String,
'password': String,
'favorites': Json List,
'name':{
'firstName': String,
'lastName': String
}
}
```
<br>
- <code class="purple">PATCH BY USER ID</code> /api/users/:id
```json=
{
(Whatever needs to be changed)
'email': String,
'password': String,
'favorites': Json List,
'name':{
'firstName': String,
'lastName': String
}
}
```
<br>
- <code class="red">DELETE BY USER ID</code> /api/users/user/:id
```json=
{
Successful!
or
Not Successful!
}
```
#### USERS FAVORITES
- <code class="green">GET FAVORITES BY USER ID</code> /api/users/favorites/:id
```json=
{
[
{
JSON Object Array of Favorites
}
]
}
```
<br>
- <code class="blue">PATCH FAVORITES BY USER ID</code> /api/users/favorites/:id
```json=
{
Json Object Array
}
```
<br>
### DISPATCHER
- <code class="green">GET BY DISPATCHER ID</code> /api/dispatchers/dispatcher/:id
```json=
{
'email': String,
'password': String,
'name':{
'firstName': String,
'lastName': String
}
}
```
<br>
- <code class="green">GET BY BUS ID</code> /api/dispatchers/bus/:id
```json=
{
'bus_ID': Int,
'route_No': Int,
'trip_ID': Int,
'GPS_ID': Int,
'location': Float,
'status': Boolean
}
```
<br>
- <code class="blue">POST BY BUS ID</code> /api/dispatchers/bus/:id
```json=
{
'bus_ID': Int,
'route_No': Int,
'trip_ID': Int,
'GPS_ID': Int,
'location': Float,
'status': Boolean
}
```
<br>
- <code class="purple">PATCH BY BUS ID</code> /api/dispatchers/bus/:id
```json=
{
'bus_ID': Int,
'route_No': Int,
'trip_ID': Int,
'GPS_ID': Int,
'location': Float,
'status': Boolean
}
```
<br>
- <code class="red">DELETE BY BUS ID</code> /api/dispatchers/bus/:id
```json=
{
Successful!
or
Not Successful!
}
```
<br>
### ADMIN
- <code class="green">GET</code> /api/admins/allDispatchers
```json=
{
JSON Object Array with all Dispatchers
}
```
<br>
- <code class="green">GET</code> /api/admins/allBuses
```json=
{
JSON Object Array with all Buses
}
```
<br>
- <code class="green">GET</code> /api/admins/allRoutes
```json=
{
JSON Object Array with all Routes
}
```
<br>
- <code class="green">GET</code> /api/admins/allUsers
```json=
{
JSON Object Array with all Users
}
```
<br>
- <code class="green">GET</code> /api/admins/allBusStops
```json=
{
JSON Object Array with all Bus Stops
}
```
<br>
- <code class="green">GET BY GPS SERIAL</code> /api/admins/buses/GPS/:serial
```json=
{
'bus_ID': Int,
'route_No': Int,
'trip_ID': Int,
'GPS_ID': Int,
'location': Float,
'status': Boolean
}
```
- <code class="blue">POST</code> /api/admins/dispatcher/
```json=
{
firstName: String,
lastName: String,
username: String,
email: String,
password: String
dispatcher: true
}
```
<br>
- <code class="blue">POST</code> /api/admins/route/
```json=
{
'route_No': Int,
'trip_ID': Int,
'bus_ID': Int
}
```
<br>
- <code class="blue">POST</code> /api/admins/admin/
```json=
{
firstName: String,
lastName: String,
username: String,
email: String,
password: String,
admin: true
}
```
<br>
- <code class="blue">POST</code> /api/admins/busStops/
```json=
{
'route_No': Int,
'stop_ID': Int,
'location': Float
}
```
<br>
- <code class="purple">PATCH BY DISPATCHER ID</code> /api/admins/dispatcher/:id
```json=
{
firstName: String,
lastName: String,
username: String,
email: String,
password: String,
dispatcher: true
}
```
<br>
- <code class="purple">PATCH BY ROUTE ID</code> /api/admins/route/:id
```json=
{
'route_No': Int,
'trip_ID': Int,
'bus_ID': Int
}
```
<br>
- <code class="purple">PATCH BY ADMIN ID</code> /api/admins/admin/:id
```json=
{
firstName: String,
lastName: String,
username: String,
email: String,
password: String,
admin: true
}
```
<br>
- <code class="purple">PATCH BY BUSSTOPS ID</code> /api/admins/busStops/:id
```json=
{
'route_No': Int,
'stop_ID': Int,
'location': Float
}
```
<br>
- <code class="red">DELETE BY BUS ID</code> /api/admins/bus/:id
```json=
{
Successful!
or
Not Successful!
}
```
<br>
- <code class="red">DELETE BY DISPATCHER ID</code> /api/admins/dispatcher/:id
```json=
{
Successful!
or
Not Successful!
}
```
<br>
- <code class="red">DELETE BY ADMIN ID</code> /api/admins/admin/:id
```json=
{
Successful!
or
Not Successful!
}
```
<br>
- <code class="red">DELETE BY BUSSTOPS ID</code> /api/admins/bussStops/:id
```json=
{
Successful!
or
Not Successful!
}
```
<br>
<style>
code.green {
color: #01A024 !important;
}
code.blue {
color: #337AB7 !important;
}
code.purple {
color: #46019A !important;
}
code.red {
color: #d30000 !important;
}
</style>