-
Notifications
You must be signed in to change notification settings - Fork 1
REST‐API
The syntax for the request body and response body will be a mixture of Typescript and JSON. That means a valid example for
{
hello?: string
}
would be
{
hello: "hello"
}
and also
{
}
Requestbody:
{
username: string // The username that was entered into the login-form
password: string // The password that was entered into the login-form
}
Response body:
{
token: string // A jwt session token
}
if login with the user data was successful
On error: 401
These routes are only used by the app.
Description: Get information about the current track such as the tracks id, the tracks name, the GeoJSON path, the length and the POI's.
Response body:
{
trackId: number
trackName: string // The name of the track, e.g. 'Malente-Lütjenburg'
trackPath: FeatureCollection<LineString> // The path of the track as a linestring
trackLength: number // The length of the track in km
pointsOfInterest: PointOfInterest[] // A list of points of interest on the given track
}
with PointOfInterest
{
id: number
percentagePosition: number // A position mapped onto percentage 0-100 e.g. 0% Malente; 100% Lütjenburg
typeId: number // Maps as Generic = 0, LevelCrossing = 1, LesserLevelCrossing = 2, Picnic = 3, TrackEnd = 4, TurningPoint = 5
name: string // Name of the POI such as 'Haltepunkt Friederikental'
description?: string // Optional description of the poi
pos: Position // A GPS position of the poi
isTurningPoint: boolean // Can a vehicle be turned at this poi?
trackId: number // Id of the track the poi is on
}
and Position
{
lat: number // Latitude of the GPS position
lng: number // Longitude of the GPS position
}
Description: Get some basic information (id, start, end) about all tracks within the system.
Response body:
[
{
id: number
name: string // E.g. "Malente-Lütjenburg"
},...
]
Description: Get track information for track that is closest to the current position.
Request body:
{
pos: Position
}
Response body:
{
trackId: number
trackName: string // The name of the track, e.g. 'Malente-Lütjenburg'
trackPath: FeatureCollection<LineString> // The path of the track as a linestring
trackLength: number // The length of the track in km
pointsOfInterest: PointOfInterest[] // A list of points of interest on the given track
}
Description: Get database uid of a vehicle for the app. Vehicles-names are unique for a track.
Request body:
{
vehicleName: string
trackId: number
}
Response body:
{
vehicleId: number
}
Description: Optionally get position of app and return information about close vehicles for the particular vehicle.
Request body:
{
vehicleId: number
pos?: Position // the current position of user
speed?: number // Speed in km/h
heading?: number // Heading of the vehicle between 0 and 359
timestamp?: number // Timestamp of gps measurement in milliseconds since epoch
}
Responsebody:
{
pos: Position // The current position as measured by vehicle
heading: number // Heading of the vehicle between 0 and 359
vehiclesNearUser: VehicleApp[] // Vehicles that should be marked on the map
percentagePositionOnTrack: number // Percentage (0-100) e.g. 0% Malente; 100% Lütjenburg
speed: number // Speed in km/h
passingPosition?: Position // Only set if needed
}
with VehicleApp
as
{
id: number
name: string // The track-unique vehicle name
track: number // The tracks id
type: number // The VehicleType id
trackerIds: string[] // Some associated trackers
pos?: Position // undefined if position is unknown.
percentagePosition: number // A position mapped onto percentage 0-100) e.g. 0% Malente; 100% Lütjenburg
heading: number // between 0 and 360
headingTowardsUser?: boolean // Is the other vehicle heading towards the user?
}
Description: Get information of all vehicles.
Response body:
[
{
id: number
name: string // Vehicles name that is track-unique
type: number // VehicleType Id
trackerIds: string[]
track: number // Track Id
},...
]
Description: Get information for vehicle with specific id.
Response body:
{
id: number
name: string // Vehicles name that is track-unique
type: number // VehicleType Id
trackerIds: string[]
track: number // Track id
}
Description:
Create a new vehicle.
Request body:
{
name: string // The name, that is attached to the vehicle, e.g. "1" for "Draisine 1"
track: number // Track id for vehicle
type: number // The id of the type
trackerIds: string[] // A possibly empty list of unique ids to identify the trackers belonging to that vehicle
}
Response body:
Contains only the unique id of the newly created vehicle.
Description: Update vehicle by id.
Request body:
{
name: string // The name, that is attached to the vehicle, e.g. "1" for "Draisine 1"
track: number // Track id for vehicle
type: number // The id of the type
trackerIds: string[] // A possibly empty list of unique ids to identify the trackers belonging to that vehicle
}
Description:
Delete a vehicle with a certain uid.
Description:
Get a list of all vehicle types that are currently registered.
Response body:
[
{
id: number // A unique id of a vehicle type
name: string // A descriptive name of the vehicle type, e.g. "Draisine", "High-Speed Train",..
description?: string // Perhaps a description of the type of vehicle, that is falls into this category
icon: string // Currently unused but might be added if other rail vehicles that need different icons are used
}
,...
]
Description:
Get a specific type by its id.
Response body:
{
id: number // A unique id of a vehicle type
name: string // A descriptive name of the vehicle type, e.g. "Draisine", "High-Speed Train",..
description?: string // Perhaps a description of the type of vehicle, that is falls into this category
icon: string // Currently unused but might be added if other rail vehicles that need different icons are used
}
Description:
Create a new vehicle type.
Request body:
{
name: string // A descriptive name of the vehicle type, e.g. "Draisine", "High-Speed Train",..
description?: string // Perhaps a description of the type of vehicle, that is falls into this category
icon: string // Currently unused but might be added if other rail vehicles that need different icons are used
}
Response body:
{
id: number // A unique id of a vehicle type
name: string // A descriptive name of the vehicle type, e.g. "Draisine", "High-Speed Train",..
description?: string // Perhaps a description of the type of vehicle, that is falls into this category
icon: string // Currently unused but might be added if other rail vehicles that need different icons are used
}
Description:
Update a vehicle type.
Request body:
{
id: number // A unique id of a vehicle type
name: string // A descriptive name of the vehicle type, e.g. "Draisine", "High-Speed Train",..
description?: string // Perhaps a description of the type of vehicle, that is falls into this category
icon: string // Currently unused but might be added if other rail vehicles that need different icons are used
}
Description:
Delete a vehicle type with a certain uid. It is a soft delete under the hood.
Description: Get all POIs.
Response body:
[
{
id: number
typeId: number // The id of the corresponding poi type
name: string // A name for the poi, such as "Feldweg 2"
description?: string // An optional description that can be added to a poi
pos: Position // The position of the POI
isTurningPoint: boolean // Deprecated currently
trackId: number // id of track the poi is on
},...
]
Description: Get one POI by its id.
Response body:
{
id: number
typeId: number // The id of the corresponding poi type
name: string // A name for the poi, such as "Feldweg 2"
description?: string // An optional description that can be added to a poi
pos: Position // The position of the POI
isTurningPoint: boolean // Deprecated currently
trackId: number // id of track the poi is on
}
Description: Create new POI for a specific track.
Request body:
{
typeId: number // The id of the corresponding poi type
name: string // A name for the poi, such as "Feldweg 2"
description?: string // An optional description that can be added to a poi
pos: Position // The position of the POI
isTurningPoint: boolean // Deprecated currently
trackId: number // id of track the poi is on
}
Response:
{
id: number // The unique id of the newly created poi.
}
and HTTP-Status 201.
Description: Update a point of interest.
Request body:
{
id: number
typeId: number // The id of the corresponding poi type
name: string // A name for the poi, such as "Feldweg 2"
description?: string // An optional description that can be added to a poi
pos: Position // The position of the POI
isTurningPoint: boolean // Deprecated currently
trackId: number // id of track the poi is on
}
Response:
{
id: number // The unique id of the updated poi
}
Description: Delete a specific point of interest.
Description: Get a list of all poitypes.
Response body:
[
{
id: number
name: string // Name of the poi type such as "Haltepunkt"
icon: POITypeIcon // Enum corresponding to certain icons
description?: string // An optional additional description
}
,...
]
with POITypeIcon
{
Generic = 0
LevelCrossing = 1
LesserLevelCrossing = 2
Picnic = 3
TrackEnd = 4
TurningPoint = 5
}
Description: Get a poitype by id.
Response body:
{
id: number
name: string // Name of the poi type such as "Haltepunkt"
icon: POITypeIcon // Enum corresponding to certain icons
description?: string // An optional additional description
}
Description: Create new poitype.
Request body:
{
name: string // Name of the poi type such as "Haltepunkt"
icon: POITypeIcon // Enum corresponding to certain icons
description?: string // An optional additional description
}
Response body:
{
id: number
name: string // Name of the poi type such as "Haltepunkt"
icon: POITypeIcon // Enum corresponding to certain icons
description?: string // An optional additional description
}
Description: Update poitype.
Request body:
{
id: number
name: string // Name of the poi type such as "Haltepunkt"
icon: POITypeIcon // Enum corresponding to certain icons
description?: string // An optional additional description
}
Description: Delete poitype.
Description: Upload the data with a geojson.
Request body:
{
start: string //e.g. Malente
end: string // e.g. Lütjenburg
path: FeatureCollection<Point, GeoJsonProperties> // The track as a geojson
}
Description: Get a list of tracks without the geojson.
Response body:
[
{
id: number
start: string //e.g. Malente
end: string // e.g. Lütjenburg
},...
]
Description: Get specific track information for some track.
Response body:
{
id: number // Positive integer to uniquely identify track
start: string // E.g. "Malente"
end: string // E.g. "Lütjenburg"
path: Feature<LineString> // The geojson path of the track
length: number // Total length of the track in meters
}
Description: Update a track by id.
Request body:
{
start: string //e.g. Malente
end: string // e.g. Lütjenburg
path: FeatureCollection<Point> // The track as geojson
}
Description: Delete a track by id.
Description: Get information about all vehicles on specific track.
Response body:
[
{
id: number
pos?: Position // undefined if position is unknown.
percentagePosition?: number // A position mapped onto percentage 0-100 e.g. 0% Malente; 100% Lütjenburg
heading?: number // between 0 and 360
name: string
track: number // track id
type: number // type id
trackerIds: string[]
}
,...
]
Description: Get all pois for some track.
Response body:
[
{
id: number,
name: string,
percentagePosition: number, // A position mapped onto percentage 0-100 e.g. 0% Malente; 100% Lütjenburg
typeId: number,
description?: string,
pos: Position, // A gps position of the poi
isTurningPoint: boolean, // Can a vehicle be turned at this poi?
trackId: number
}
,...
]
Description: Get a list of all the available users.
Response body:
[
{
username: string
},...
]
Description: Create a new user with a fixed password that later needs to be changed. Only for logged in users.
Request body:
{
username: string
password: string
}
Description: Change the own password. Only for logged in users. Old password needs to be correct.
Request body:
{
oldPassword: string
newPassword: string
}
Description: Used to change the own username. Only for logged in users. Old username needs to be correct.
Request body:
{
oldUsername: string
newUsername: string
}
Description: Used to delete user with userId
. Only for logged in users.
Description: Get information of all trackers.
Response body:
[
{
id: string
vehicleId: number | null // The id of the corresponding vehicle if there is such
data?: unknown // optional additional data
},...
]
Description: Get a specific tracker's information.
Response body:
{
id: string
vehicleId: number | null // The id of the corresponding vehicle if there is such
battery?: number // Voltage of battery
data?: unknown // optional additional data
}
Description: Create a tracker.
Requestbody:
{
id: string,
vehicleId: number | null // The id of the corresponding vehicle if there is such
battery?: number // Voltage of battery
data?: unknown // optional additional data
}
Response body:
{
id: string
vehicleId: number | null // The id of the corresponding vehicle if there is such
data?: unknown // optional additional data
}
Description: Update a specific tracker.
Request body:
{
id: string
vehicleId: number | null // The id of the corresponding vehicle if there is such
data?: unknown // optional additional data
}
Description: Delete a specific tracker.
Description: Upload link for the data from the LoRaWAN trackers.
Request body:
{
end_device_ids: EndDeviceIdsTracker
received_at: string
uplink_message: UplinkMessageTracker
}
with EndDeviceIdsTracker
:
{
device_id: string
}
and UplinkMessageTracker
:
{
f_port: number
decoded_payload: DecodedPayloadTracker
}
and DecodedPayloadTracker
:
{
batV: number
fixFailed: boolean
headingDeg: number
inTrip: boolean
latitudeDeg: number
longitudeDeg: number
speedKmph: number
type: string
}
Description: Upload link for the data from the IoT-LTE-trackers.
Request body:
{
SerNo: number
IMEI: string
ICCID: string
ProdId: number
FW: string
Records: LteRecord[]
}
with LteRecord
{
SeqNo: number
Reason: number
DateUTC: string
Fields: any // list of heterogenous objects depending on FType
}