Skip to content

Commit 7646491

Browse files
avatarneilthekaveman
authored andcommitted
Move near-rt data requirements so they can be re-used, clean up endpoint information
1 parent 3f13def commit 7646491

1 file changed

Lines changed: 29 additions & 10 deletions

File tree

provider/README.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,15 @@ Please refer to the MDS [General Information][general-information] document.
150150

151151
[Top][toc]
152152

153+
### Near-RT Data Requirements
154+
155+
All near-RT endpoints must contain `last_updated` and `ttl` properties in the top-level of the response body. These properties are defined as:
156+
157+
Field Name | Required | Defines
158+
--------------------| ----------| ----------
159+
last_updated | Yes | Timestamp indicating the last time the data in this feed was updated
160+
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).
161+
153162
## Trips
154163

155164
A trip represents a journey taken by a *mobility as a service* customer with a geo-tagged start and stop point.
@@ -331,8 +340,23 @@ Should either side of the requested time range be greater than 2 weeks before th
331340

332341
Stop information should be updated on a near-realtime basis by providers who operate _docked_ mobility devices in a given municipality.
333342

334-
Endpoint: `/stops/{stop_id}`
335-
Method: `GET`
343+
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 in accordance with the [Near RT Data Requirements](#near-rt-data-requirements):
344+
345+
```json
346+
{
347+
"version": "x.y.z",
348+
"data": {
349+
"stops": []
350+
},
351+
"last_updated": "12345",
352+
"ttl": "12345"
353+
}
354+
```
355+
356+
**Endpoint:** `/stops/:stop_id`
357+
**Method:** `GET`
358+
**[Beta feature](/general-information.md#beta-features):** Yes (as of 1.0.0)
359+
**`data` Payload:** `{ "stops": [] }`, an array of objects with the following structure
336360

337361
| Field | Type | Required/Optional | Description |
338362
|------------------------|------------------------|-------------------|------------------------------------------------------------------------------------------------------------------------------------------------------|
@@ -355,6 +379,8 @@ Method: `GET`
355379
| wheelchair_boarding | Boolean | Optional | Is this stop handicap accessible? |
356380
| parent_stop | UUID | Optional | Describe a basic hierarchy of stops (e.g.a stop inside of a greater stop) |
357381

382+
In the case that a `stop_id` query parameter is specified, the `stops` array returned will only have one entry. In the case that no `stop_id` query parameter is specified, all stops will be returned.
383+
358384
### GBFS Compatibility
359385

360386
Some of the fields in the `Stops` definition are using notions which are currently not in MDS, such as `rental_methods`. These fields are included for compatibility with GBFS.
@@ -365,7 +391,7 @@ Some of the fields in the `Stops` definition are using notions which are current
365391

366392
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. As with other MDS APIs, `/vehicles` is intended for use by regulators, not by the general public. It does not replace the role of a [GBFS][gbfs] feed in enabling consumer-facing applications.
367393

368-
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:
394+
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 in accordance with the [Near RT Data Requirements](#near-rt-data-requirements):
369395

370396
```json
371397
{
@@ -378,13 +404,6 @@ In addition to the standard [Provider payload wrapper](#response-format), respon
378404
}
379405
```
380406

381-
Where `last_updated` and `ttl` are defined as follows:
382-
383-
Field Name | Required | Defines
384-
--------------------| ----------| ----------
385-
last_updated | Yes | Timestamp indicating the last time the data in this feed was updated
386-
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).
387-
388407
**Endpoint:** `/vehicles`
389408
**Method:** `GET`
390409
**[Beta feature][beta]:** Yes (as of 0.4.1)

0 commit comments

Comments
 (0)