Skip to content

Commit 8246102

Browse files
authored
Adding a /vehicles endpoint to show the current status of the fleet (#376)
1 parent 3334b27 commit 8246102

5 files changed

Lines changed: 678 additions & 59 deletions

File tree

provider/README.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This specification contains a data standard for *mobility as a service* provider
1010
* [Realtime Data](#realtime-data)
1111
* [GBFS](#GBFS)
1212
* [Events](#events)
13+
* [Vehicles](#vehicles)
1314

1415
## General Information
1516

@@ -395,12 +396,58 @@ Should either side of the requested time range be missing, `/events` shall retur
395396

396397
Should either side of the requested time range be greater than 2 weeks before the time of the request, `/events` shall return a `400 Bad Request` error.
397398

399+
### Vehicles
400+
401+
The `/vehicles` endpoint returns the current status of vehicles on the PROW. Only vehicles that are currently in available, unavailable, or reserved states should be returned in this payload. Data in this endpoint should reconcile with data from the `/status_changes` enpdoint. The data returned by this endpoint should be as close to realtime as possible, but in no case should it be more than 5 minutes out-of-date.
402+
403+
In addition to the standard [Provider payload wrapper](#response-format), responses from this endpoint should contain the last update timestamp and amount of time until the next update:
404+
405+
```json
406+
{
407+
"version": "x.y.z",
408+
"data": {
409+
"vehicles": []
410+
},
411+
"last_updated": "12345",
412+
"ttl": "12345"
413+
}
414+
```
415+
416+
Where `last_updated` and `ttl` are defined as follows:
417+
418+
Field Name | Required | Defines
419+
--------------------| ----------| ----------
420+
last_updated | Yes | Timestamp indicating the last time the data in this feed was updated
421+
ttl | Yes | Integer representing the number of milliseconds before the data in this feed will be updated again (0 if the data should always be refreshed).
422+
423+
**Endpoint:** `/vehicles`
424+
**Method:** `GET`
425+
**Required/Optional:** Optional starting with `0.4.1`, moving to Required in a future version (`0.5.0`+)
426+
**Schema:** [`vehicles` schema][vehicles-schema]
427+
**`data` Payload:** `{ "vehicles": [] }`, an array of objects with the following structure
428+
429+
| Field | Type | Required/Optional | Comments |
430+
| ----- | ---- | ----------------- | ----- |
431+
| `provider_id` | UUID | Required | A UUID for the Provider, unique within MDS |
432+
| `provider_name` | String | Required | The public-facing name of the Provider |
433+
| `device_id` | UUID | Required | A unique device ID in UUID format, should match this device in Provider |
434+
| `vehicle_id` | String | Required | The Vehicle Identification Number visible on the vehicle itself, should match this device in provider |
435+
| `vehicle_type` | Enum | Required | see [vehicle types](#vehicle-types) table |
436+
| `propulsion_type` | Enum[] | Required | Array of [propulsion types](#propulsion-types); allows multiple values |
437+
| `last_event_time` | [timestamp][ts] | Required | Date/time when last status change occurred. See [Event Times](#event-times) |
438+
| `last_event_type` | Enum | Required | Event type of most recent status change. See [event types](#event-types) table |
439+
| `last_event_type_reason` | Enum | Required | Event type reason of most recent status change, allowable values determined by [`event type`](#event-types) |
440+
| `last_event_location` | GeoJSON [Point Feature][geo]| Required | Location of vehicle's last event |
441+
| `current_location` | GeoJSON [Point Feature][geo] | Required if Applicable | Current location of vehicle if different from last event, and the vehicle is not currently on a trip |
442+
| `battery_pct` | Float | Required if Applicable | Percent battery charge of device, expressed between 0 and 1 |
443+
398444
[Top][toc]
399445

400446
[general-information/versioning]: /general-information.md#versioning
401447
[geo]: #geographic-data
402-
[sc-schema]: status_changes.json
448+
[sc-schema]: dockless/status_changes.json
403449
[status]: #status-changes
404450
[toc]: #table-of-contents
405-
[trips-schema]: trips.json
451+
[trips-schema]: dockless/trips.json
406452
[ts]: #timestamps
453+
[vehicles-schema]: dockless/vehicles.json

0 commit comments

Comments
 (0)