sharee.bike-Wiki/4.3.-op-request=booking_update.md

125 lines
5.2 KiB
Markdown
Raw Normal View History

2022-01-29 10:57:12 +01:00
### request=booking_update
**request** PUSH start, pause, cancel and end bike rental is implemented via this update request. Prerequisite is the reservation via the initial "request=booking_request".
The following booking states are implemented:
2022-12-29 09:22:48 +01:00
2022-01-29 10:57:12 +01:00
`state=canceled` booking request will be canceled. The bike is set to `state=available` in the COPRI backend.
2022-12-29 09:22:48 +01:00
2022-12-29 10:28:22 +01:00
`state=occupied` bike rental starts. `state=occupied` marks the start of the rental in copri. A multiple "occupied" will be acknowledged with an error, because a rental can only be started once. So that the rental start is recorded in any case in the backend, please set the `state=occupied` in the request before the smartlock will be unlocked.
2022-12-29 09:22:48 +01:00
2022-01-29 10:57:12 +01:00
`state=available` end the bike rental, which makes the bike `state=available` again in the COPRI backend.
The following lock states are implemented:
2022-12-29 09:22:48 +01:00
2022-06-03 17:37:44 +02:00
`lock_state=unlocking` start unlocking signal, smartlock was triggered to unlock.
2022-12-29 09:22:48 +01:00
2022-01-29 10:57:12 +01:00
`lock_state=unlocked` successfully unlocking the lock.
2022-12-29 09:22:48 +01:00
2022-06-03 17:37:44 +02:00
`lock_state=locking` start locking signal, smartlock was triggered to close.
2022-12-29 09:22:48 +01:00
2022-01-29 10:57:12 +01:00
`lock_state=locked` closed successfully.
| key | Required | Format | Comment |
| ------------ | ----------- | -------- | ------------------------------ |
| authcookie | + | text | unique encrypted key |
| bike | + | text | bike prefix+number |
| state | + | text | one of the bike states: canceled, occupied, available |
2022-12-29 09:22:48 +01:00
| lock_state | o/+ | text | one of the lock states: unlocking, unlocked, locking, locked |
| station_state | o | text | station smartlock locking state |
2022-01-29 10:57:12 +01:00
| latitude | + | text | App GPS only necessary on state=available |
| longitude | + | text | App GPS only necessary on state=available |
| gps_age | o/+ | text | App GPS age only necessary on state=available. value in milliseconds. |
| gps_accuracy | o | text | App GPS accuracy on state=available in meters | |
| firmware | o | text | Firmware Version |
| Ilockit_GUID | o | text | example: 00000000-0000-0000-e57e6b9aee16 |
2022-01-29 10:59:27 +01:00
**response** returns `bikes_occupied` JSON-Objects with booking states
2022-01-29 10:57:12 +01:00
Example
**request** starts bike rental and unlock smartlock at once. lock_state=unlocked can also be done on second request.
```
2022-06-03 17:35:18 +02:00
https://sharee-zr01.example.tld/APIjsonserver?request=booking_update&bike=FR1540&state=occupied&lock_state=unlocked&authcookie=6103_7dc3c95028d06c9663378f6d44346de7_12345678
2022-01-29 10:57:12 +01:00
```
2022-01-29 10:59:27 +01:00
**response** sharee JSON defaults + **response** rental states in `user_bikes_occupied` JSON-objects
2022-01-29 10:57:12 +01:00
```
{
"shareejson" : {
***sharee JSON defaults***
},
"bikes_occupied" : {
"155896" : {
"start_time" : "2021-10-28 18:09:17.454818+02",
"unit_price" : "2.00",
"description" : "Vauban-bike (Ilockit)",
"lock_state" : "unlocked",
"request_time" : "2021-10-28 17:56:07.541766+02",
"K_u" : "[-26, 6, -7, -80, 82, -71, -117, 57, 24, -91, 32, -44, 80, -112, 32, -66, -51, -106, 100, -99, 0, 0, 0, 0]",
"K_seed" : "[122, -30, 85, -21, -47, 71, 54, 25, -60, -53, 78, 49, -74, 84, 72, 63]",
"bike_group" : [
"FR300001"
],
"uri_operator" : "https://shareeapp-fr01.copri-bike.de",
"real_hours" : "0",
"system" : "Ilockit",
"computed_hours" : "0",
"gps" : {
"longitude" : "7.825490",
"latitude" : "47.976634"
},
2022-07-15 14:41:55 +02:00
"bike_type" : {
"category" : "cargo",
"engine" : {
"manufacturer" : "dummy"
},
"wheels" : "2"
}
},
"rental_description" : {
2022-06-03 17:29:10 +02:00
"tarif_elements" : {
2022-06-03 17:35:18 +02:00
"4" : [
"Max. Gebühr",
"10,00 € / Tag"
],
"6" : [
"Gratis Mietzeit",
"20 Min / Tag"
],
2022-06-03 17:29:10 +02:00
"1" : [
"Mietgebühr",
2022-06-03 17:35:18 +02:00
"1,50 € / 30 Min "
2022-06-03 17:29:10 +02:00
],
2022-06-03 17:35:18 +02:00
"7" : [
"Aktuelle Mietzeit",
"7 Std 12 Min "
2022-06-03 17:29:10 +02:00
],
2022-06-03 17:35:18 +02:00
"8" : [
"Aktuelle Mietkosten",
"9,00 €"
2022-06-03 17:29:10 +02:00
]
},
"id" : "5519",
"name" : "Cargo-Bikes",
"rental_info" : {
"2" : [
"AGB",
"Mit der Mietrad Anmietung wird der Betreiber AGB zugestimmt."
]
}
2022-01-29 10:57:12 +01:00
},
"state" : "occupied",
"bike" : "FR1540",
"total_price" : "0.00",
"station" : "FR101",
"Ilockit_GUID" : "00000000-0000-0000-0000-fc3c002a2add",
"Ilockit_ID" : "ISHAREIT-2200540",
"end_time" : "2021-10-28 18:09:19"
}
},
"155899" : {
...
}
}
```