sharee.bike-Wiki/4.3.-op-request=booking_update.md
2023-11-22 18:23:41 +00:00

5.2 KiB

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=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.

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=unlocking start unlocking signal, smartlock was triggered to unlock.

lock_state=unlocked successfully unlocking the lock.

lock_state=locking start locking 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: unlocking, unlocked, locking, locked
station_state o text station smartlock locking state
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 bikes_occupied JSON-Objects with booking states

Example request starts bike rental and unlock smartlock at once. lock_state=unlocked can also be done on second request.

https://sharee-zr01.example.tld/APIjsonserver?request=booking_update&bike=FR1540&state=occupied&lock_state=unlocked&authcookie=6103_7dc3c95028d06c9663378f6d44346de7_12345678

response sharee JSON defaults + response rental states in 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"
            },
            "bike_type" : {
               "category" : "cargo",
               "engine" : {
                  "manufacturer" : "dummy"
               },
               "wheels" : "2"
            }
          },
          "rental_description" : {
               "tarif_elements" : {
                 "4" : [
                     "Max. Gebühr",
                     "10,00 € / Tag"
                  ],
                  "6" : [
                     "Gratis Mietzeit",
                     "20 Min  / Tag"
                  ],
                  "1" : [
                     "Mietgebühr",
                     "1,50 € / 30 Min "
                  ],
                  "7" : [
                     "Aktuelle Mietzeit",
                     "7 Std 12 Min "
                  ],
                  "8" : [
                     "Aktuelle Mietkosten",
                     "9,00 €"
                  ]
               },
               "id" : "5519",
               "name" : "Cargo-Bikes",
               "rental_info" : {
                  "2" : [
                     "AGB",
                     "Mit der Mietrad Anmietung wird der Betreiber AGB zugestimmt."
                  ]
               }
            },
            "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" : {
           ...
        }
}