You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: agency/README.md
+12-43Lines changed: 12 additions & 43 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,37 +17,21 @@ This specification contains a collection of RESTful APIs used to specify the dig
17
17
18
18
## General information
19
19
20
-
This specification uses data types including timestamps, UUIDs, and vehicle state definitions as described in the MDS [Shared Definitions](#../shared/README.md) document.
20
+
This specification uses data types including timestamps, UUIDs, and vehicle state definitions as described in the MDS [General Information][general] document.
21
21
22
22
### Versioning
23
23
24
24
`agency` APIs must handle requests for specific versions of the specification from clients.
25
25
26
-
Versioning must be implemented as specified in the [`General information versioning section`][general-information/versioning].
27
-
28
-
### Authorization
29
-
30
-
The following information applies to all `agency` API endpoints.
31
-
32
-
Currently, the `agency` API is implemented for dockless scooter, bikeshare, and carshare. To implement another mode, add it to the `schema/generate_schema.py` file and this README and submit a pull request.
26
+
Versioning must be implemented as specified in the [`General information versioning section`][versioning].
33
27
34
28
### Responses
35
29
36
-
***200:** OK: operation successful.
37
-
***201:** Created: `POST` operations, new object created
38
-
***400:** Bad request.
39
-
***401:** Unauthorized: Invalid, expired, or insufficient scope of token.
40
-
***404:** Not Found: Object does not exist, returned on `GET` or `POST` operations if the object does not exist.
41
-
***409:** Conflict: `POST` operations when an object already exists and an update is not possible.
42
-
***500:** Internal server error: In this case, the answer may contain a `text/plain` body with an error message for troubleshooting.
Copy file name to clipboardExpand all lines: general-information.md
+143-7Lines changed: 143 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,21 +6,30 @@ This document contains specifications that are shared between the various MDS AP
6
6
7
7
*[Versioning](#versioning)
8
8
*[Beta Features](#beta-features)
9
+
*[Responses](#responses)
10
+
*[Error Message Format](#error-message-format)
11
+
*[Timestamps](#timestamps)
12
+
*[Strings](#strings)
13
+
*[UUIDs](#uuids)
14
+
*[Costs and Currencies](#costs-and-currencies)
15
+
*[Devices](#devices)
16
+
*[Vehicle Types](#vehicle-types)
17
+
*[Propulsion Types](#propulsion-types)
18
+
*[Vehicle States](#vehicle-states)
19
+
*[Vehicle Events](#vehicle-events)
9
20
10
21
## Versioning
11
22
12
23
MDS APIs must handle requests for specific versions of the specification from clients.
13
24
14
-
Versioning must be implemented through the use of a custom media-type, `application/vnd.mds.provider+json`, combined with a required `version` parameter.
25
+
Versioning must be implemented through the use of a custom media-type, `application/vnd.mds+json`, combined with a required `version` parameter.
15
26
16
-
The version parameter specifies the dot-separated combination of major and minor versions from a published version of the specification. For example, the media-type for version `0.2.1` would be specified as `application/vnd.mds.provider+json;version=0.2`
17
-
18
-
> Note: Normally breaking changes are covered by different major versions in semver notation. However, as this specification is still pre-1.0.0, changes in minor versions may include breaking changes, and therefore are included in the version string.
27
+
The version parameter specifies the dot-separated combination of major and minor versions from a published version of the specification. For example, the media-type for version `1.0.1` would be specified as `application/vnd.mds+json;version=1.0`
19
28
20
29
Clients must specify the version they are targeting through the `Accept` header. For example:
> Since versioning was not available from the start, the following APIs provide a fallback version if the `Accept` header is not set as specified above:
@@ -35,18 +44,37 @@ A client negotiates available versions using the `OPTIONS` method to an MDS endp
|`error_description`| String | Human readable error description (can be localized) |
74
+
|`error_details`| String[]| Array of error details |
75
+
49
76
## Beta Features
77
+
50
78
In some cases, features within MDS may be marked as "beta." These are typically recently added endpoints or fields. Because beta features are new, they may not yet be fully mature and proven in real-world operation. The design of beta features may have undiscovered gaps, ambiguities, or inconsistencies. Implementations of those features are typically also quite new and are more likely to contain bugs or other flaws. Beta features are likely to evolve more rapidly than other parts of the specification.
51
79
52
80
Despite this, MDS users are highly encouraged to use beta features. New features can only become proven and trusted through implementation, use, and the learning that comes with it. Users should be thoughtful about the role of beta features in their operations. Beta features may be suitable for enabling some new tools and analysis, but may not be appropriate for mission-critical applications or regulatory decisions where certainty and reliability are essential.
@@ -56,3 +84,111 @@ Users of beta features are strongly encouraged to share their experiences, learn
56
84
Working Groups and their Steering Committees are expected to review beta designated features with each release cycle and determine whether the feature has reached the level of stability and maturity needed to remove the beta designation. In a case where a beta feature fails to reach substantial adoption after an extended time, Working Group Steering Committees should discuss whether or not the feature should remain in the specification.
57
85
58
86
[Top](#table-of-contents)
87
+
88
+
## Timestamps
89
+
90
+
A `timestamp` refers to integer milliseconds since Unix epoch.
91
+
92
+
## Strings
93
+
94
+
All String fields, such as `vehicle_id`, are limited to a maximum of 255 characters.
95
+
96
+
## UUIDs
97
+
98
+
Object identifiers are described via Universally Unique Identifiers [(UUIDs)](https://en.wikipedia.org/wiki/Universally_unique_identifier). For example, the `device_id` field used to uniquely identify a vehicle is a UUID.
99
+
100
+
MDS uses Version 1 UUIDs.
101
+
102
+
## Costs and currencies
103
+
104
+
Fields specifying a monetary cost use a currency as specified in [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217#Active_codes). All costs should be given as integers in the currency's smallest unit. As an example, to represent $1 USD, specify an amount of `100` (100 cents).
105
+
106
+
If the currency field is null, USD cents is implied.
107
+
108
+
## Devices
109
+
110
+
MDS defines the *device* as the unit that transmits GPS or GNSS signals for a particular vehicle. A given device must have a UUID (`device_id` below) that is unique within the Provider's fleet.
111
+
112
+
Additionally, `device_id` must remain constant for the device's lifetime of service, regardless of the vehicle components that house the device.
113
+
114
+
## Vehicle Types
115
+
116
+
The list of allowed `vehicle_type` values in MDS is:
117
+
118
+
|`vehicle_type`| Description |
119
+
|--------------| --- |
120
+
| bicycle | Anything with pedals, including recumbents; can include powered assist |
121
+
| car | Any automobile |
122
+
| scooter | Any motorized mobility device intended for one rider |
123
+
| moped | A motorcycle/bicycle hybrid that can be powered or pedaled |
|`electric_assist`| Provides power only alongside human propulsion |
131
+
|`electric`| Contains throttle mode with a battery-powered motor |
132
+
|`combustion`| Contains throttle mode with a gas engine-powered motor |
133
+
134
+
A vehicle may have one or more values from the `propulsion`, depending on the number of modes of operation. For example, a scooter that can be powered by foot or by electric motor would have the `propulsion` represented by the array `['human', 'electric']`. A bicycle with pedal-assist would have the `propulsion` represented by the array `['human', 'electric_assist']` if it can also be operated as a traditional bicycle.
135
+
136
+
## Vehicle States
137
+
138
+
This table describes the list of vehicle conditions that may be used by regulators to assess the disposition of individual vehicles and fleets of vehicles. Some of these states describe vehicles in the Public Right-of-Way (PROW), and others represent vehicles that are not. One state (`unknown`) implies that PROW status is unknown.
139
+
140
+
In a multi-jurisdiction environment, the status of a vehicle is per-jurisdiction. For example, a vehicle may be in the `trip` status for a county that contains five cities, and also in the `trip` status for one of those cities, but `elsewhere` for the other four cities. In such a condition, generally a Provider would send the device data to the over-arching jurisdiction (the county) and the vehicle state with respect to each city would be determined by the Agency managing the jurisdictions.
141
+
142
+
|`vehicle_state`| In PROW? | Description |
143
+
| --- | --- |
144
+
|`removed`| no | Examples include: at the Provider's warehouse, in a Provider's truck, or destroyed and in a landfill. |
145
+
|`available`| yes | Available for rental via the Provider's app. In PROW. |
146
+
|`unavailable`| yes | Not available for rent. Examples include: vehicle has low battery, or currently outside legal operating hours. |
147
+
|`reserved`| yes | Reserved via Provider's app, waiting to be picked up by a rider. |
148
+
|`trip`| yes | In posession of renter. May or may not be in motion. |
149
+
|`elsewhere`| no | Outside of regulator's jurisdiction, and thus not subject to cap-counts or other regulations. Example: a vehicle that started a trip in L.A. has transitioned to Santa Monica. |
150
+
|`unknown`| unknown | Provider has lost contact with the vehicle and its disposition is unknown. Examples include: taken into a private residence, thrown in river. |
151
+
152
+
## Vehicle Events
153
+
154
+
This is the list of `vehicle_state` and `event_type` pairings that constitute the valid transitions of the vehicle state machine.
155
+
156
+
Note that to handle out-of-order events, the validity of the prior-state is not enforced at the time of ingest via Provider or Agency. Events received out-of-order may result in transient incorrect vehicle states.
|`unavailable`|`available`|`battery_charged`| The vehicle became available because its battery is now charged. |
161
+
|`unavailable`|`available`|`on_hours`| The vehicle has entered operating hours (per the regulator or per the provider) |
162
+
|`removed`, `elsewhere`, `unknown`|`available`|`provider_drop_off`| The vehicle was placed in the PROW by the provider |
163
+
|`removed`, `elsewhere`, `unknown`|`available`|`agency_drop_off`| The vehicle was placed in the PROW by a city or county |
164
+
|`unavailable`|`available`|`maintenance`| The vehicle was previously in need of maintenance |
165
+
|`trip`|`available`|`trip_end`| A trip has ended, and the vehicle is again available for rent |
166
+
|`reserved`|`available`|`reservation_cancel`| A reservation was canceled and the vehicle returned to service |
167
+
|`trip`|`available`|`trip_cancel`| A trip was initiated, then canceled prior to moving any distance |
168
+
|`unavailable`, `unknown`, `removed`, `reserved`, `elsewhere`|`available`|`unspecified`| The vehicle became available, but the provider cannot definitively (yet) specify the reason. Generally, regulator Service-Level Agreements will limit the amount of time a vehicle's last event type may be `unspecified`. |
169
+
|`available`|`reserved`|`reservation_start`| The vehicle was reserved for use by a customer |
170
+
|`available`, `reserved`|`trip`|`trip_start`| A customer initiated a trip with this vehicle |
171
+
|`elsewhere`|`trip`|`trip_enter_jurisdiction`| A vehicle on a trip entered the jurisdiction |
172
+
|`trip`|`elsewhere`|`trip_leave_jurisdiction`| A vehicle on a trip left the jurisdiction |
173
+
|`available`|`unavailable`|`low_battery`| The vehicle's battery is below some rentability threshold |
174
+
|`available`|`unavailable`|`maintenance`| The vehicle requires some non-charge-related maintenance |
175
+
|`available`|`unavailable`|`off_hours`| The vehicle has exited operating hours (per the regulator or per the Provider) |
176
+
|`available`|`unavailable`|`unspecified`| The vehicle became unavailable, but he Provider cannot definitively (yet) specify the reason. |
177
+
|`available`, `unavailable`, `elsewhere`|`removed`|`rebalance_pick_up`| The provider picked up the vehicle for rebalancing purposes |
178
+
|`available`, `unavailable`, `elsewhere`|`removed`|`maintenance_pick_up`| The provider picked up the vehicle to service it |
179
+
| any |`removed`|`agency_pick_up`| An agency picked up the vehicle for some reason, e.g. illegal placement |
180
+
|`available`, `unavailable`, `elsewhere`|`removed`|`compliance_pick_up`| The provider picked up the vehicle because it was placed in a non-compliant location |
181
+
|`available`, `unavailable`, `removed`, `elsewhere`, `unknown`|`removed`|`decommissioned`| The provider has removed the vehicle from its fleet |
182
+
|`unknown`, `unavailable`, `available`, `elsewhere`|`removed`|`unspecified`| The vehicle was removed, but the provider cannot definitively (yet) specify the reason |
183
+
| any |`unknown`|`missing`| The vehicle is not at its last reported GPS location, or that location is wildly in error |
184
+
| any |`unknown`|`out_of_comms`| The vehicle is unable to transmit its GPS location |
0 commit comments