sharee.bike-Wiki/3.-sharee.bike-API-description.md

50 lines
3.1 KiB
Markdown
Raw Normal View History

2022-01-28 11:53:23 +01:00
## sharee.bike API description
2023-11-22 17:57:28 +01:00
Version 4.1.23.22
2022-01-28 11:53:23 +01:00
The document serves as a technical reference for the sharee.bike rental bike platform for rental bike client development. The rental bike management server COPRI serves as the backend system.
### 1. Intro
The data exchange format is based on HTTP's REST methods.
- COPRI expects the client-side https requests to be "urlencoded" (https post, https get).
- The server-side https responses are delivered by COPRI in JSON format.
**Multi-operator rental bike booking system** implements a decentralized rental bike booking system across multiple sharee operator instances. Each operator instance is exclusively available to a rental bike operator for the administrative management of the operator rental bike data. The client-side user authentication takes place via the *primary COPRI-server (single-sign-on)*. Successful user authentication can be recognized by an *authcookie* of at least 30 characters in the JSON response. An empty *authcookie* means that the user is not authenticated.
**Rental bike bookings** are only possible after successful user authentication.
2022-07-28 14:58:57 +02:00
The primary server (uri_primary) is used for:
- request=authentication
- request=authout
- request=stations_available
- request=user_bikes_occupied
- request=user_minianswer
2023-11-22 17:56:17 +01:00
The operator server (uri_operator) responsible for the rental process is used for:
2023-11-22 17:54:47 +01:00
- request=bikes_available
2022-07-28 14:58:57 +02:00
- request=booking_request
- request=booking_update
- request=user_feedback
2022-01-28 11:53:23 +01:00
**encoding** UTF-8. All scalar JSON values are delivered as data type "char" (text).
**Glossary**
| table-column | value | description |
|--------------|-----------|------------------------------------------------------|
| Format | text>=8 | UTF-8 encoded characters with a character length >= 8 |
| Format | date time | ISO 8601 (YYYY-MM-DD hh:mm:ss) timestamp |
| Format | object | sub-datatype JSON Object |
| Format | array | datatype Array |
| Required | + | Field assignment mandatory |
| Required | o | Field assignment optional |
The user authentication expects the following 4 parameters.
- user_id: `mail@example.tld`
- user_pw: `example-pw`
- hw_id: `unique-system-identifier`
- merchant_id: `your merchant id` (for id contact us)
The *hw_id* with at least 16 characters must be unique. In live operation, the hw_id should be read from the client system (unique-system-identifier). After successful authentication, an *authcookie* is generated on the server side from the *authorization* parameters.
**Requests** in the context of rental bike bookings, a valid *authcookie* is always expected in REST, which authenticates the user after a successful login and authorizes him to use the system.
No prior user authentication is required to query the available stations and rental bikes. An *authcookie* with the *merchant_id* customer ID is expected as a minimum requirement. I.e. **authcookie=merchant_id**