From ef1df359a84516ca9ad1925557ef5cc4b510835a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rainer=20G=C3=BCmpelein?= Date: Sat, 29 Jan 2022 09:57:12 +0000 Subject: [PATCH] Create 4.2. op request=booking_update --- 4.2.-op-request=booking_update.md | 83 +++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 4.2.-op-request=booking_update.md diff --git a/4.2.-op-request=booking_update.md b/4.2.-op-request=booking_update.md new file mode 100644 index 0000000..0c3c1c2 --- /dev/null +++ b/4.2.-op-request=booking_update.md @@ -0,0 +1,83 @@ +### 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: +`state=canceled` booking request will be canceled. The bike is set to `state=available` in the COPRI backend. +`state=occupied` bike rental starts. +`state=available` end the bike rental, which makes the bike `state=available` again in the COPRI backend. + +The following lock states are implemented: +`lock_state=unlocked` successfully unlocking the lock. +`lock_state=locking` end rent signal, smartlock was triggered to close. +`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 | +| lock_state | o/+ | text | one of the lock states: locked, locking, unlocked | +| 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 | + + +**response** returns also **request=user_bikes_occupied** with `bikes_occupied` JSON-Objects + +Example +**request** starts bike rental and unlock smartlock at once. lock_state=unlocked can also be done on second request. +``` +https://shareeapp-fr01.copri-bike.de/APIjsonserver?request=booking_update&bike=FR1540&state=occupied&lock_state=unlocked&authcookie=6103_7dc3c95028d06c9663378f6d44346de7_12345678 +``` + +**response** sharee JSON defaults + **response** rental state with `user_bikes_occupied` JSON-objects +``` +{ + "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" + }, + "tariff_description" : { + "max_eur_per_day" : "15.00", + "eur_per_hour" : "2.00", + "name" : "Vauban Bonus", + "number" : "5504", + "free_hours" : "1.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" : { + ... + } +} +``` \ No newline at end of file