sharee.bike-Wiki/3.5.-pri-request=bikes_available.md
2022-12-30 14:40:38 +00:00

139 lines
5.8 KiB
Markdown

### request=bikes_available
**request** GET of the available rental bikes with the optional specification **station** and/or **system**.
| key | Required | Format | Comment |
| ---------- | -------- | ------- | ----------------------------------- |
| authcookie | + | text>=8 | unique encrypted key OR merchant_id |
| system | o | text | bike lock system |
| station | o | text | station prefix+number |
**response** list of bikes by JSON-Objects
| key | Required | Format | Comment |
| -------------- | -------- | -------- | -------------------------------------- |
| state | + | text | bike available state |
| lock_state | + | text | bike smartlock locking state |
| description | o | text | short bike description |
| bike | + | text | bike prefix+number |
| gps | + | array | GPS: latitude, longitude |
| station | + | text | station prefix+number |
| bike_group | + | array | bike group |
| system | + | text | bike lock system |
| uri_operator | + | text | URI of Operator-Server |
| lockit_ID | + | text | bluetooth ID |
| lockit_GUID | + | text | bluetooth GUID |
| authed | + | text | if 1 then authenticated request on operator |
| rental_description | + | object | with tarif_elements and rental_info |
| bike_type | + | object | describes the bike with some attributes |
| smartlock_type | o | object | (under development) describes the smartlock with some attributes |
**rental_description** JSON Object
| key | Required | Format | Comment |
| ------------------ | -------- | ---------------- | -------------------------- |
| name | + | text | Tarif name |
| id | + | text | Tarif number |
| tarif_elements | + | object with array | contains an indexed array with tarif data |
| rental_info | + | object with array | contains an indexed array with rental information |
**bike_type** JSON Object
| key | Required | Format | Comment |
| ------------------ | -------- | ---------------- | -------------------------- |
| category | o | text | "city" or "cargo" |
| wheels | o | text | "2" or "3" |
| engine | o | object | contains engine attributes like "manufacturer" |
| battery | o | object | contains bike battery attributes. "hidden=0" means not in App visible. "backend_accessible=0" means no bike charge API available |
**smartlock_type** JSON Object
| key | Required | Format | Comment |
| ------------------ | -------- | ---------------- | -------------------------- |
| engine | o | object | contains engine attributes like "manufacturer" |
| battery | o | object | contains smartlock battery attributes. |
Example
**REST request=bikes_available** for authorized users
```
https://sharee-primary.example.tld/APIjsonserver?request=bikes_available&authcookie=6103_f782a208d9399291ba8d086b5dcc2509_23456789
```
**response** sharee JSON defaults + **response** multiple bike objects
```
{
"shareejson" : {
***sharee JSON defaults***
},
"bikes" : {
"WUE5525" : {
"gps" : {
"latitude" : "47.987975491085045",
"longitude" : "7.816756743460897"
},
"bike_type" : {
"battery" : {
"charge_current_bars" : "4",
"hidden" : "0",
"charge_max_bars" : "5",
"backend_accessible" : "0",
"charge_current_percent" : "70"
},
"category" : "cargo",
"wheels" : "2",
"engine" : {
"manufacturer" : "dummy"
}
},
"rental_description" : {
"tarif_elements" : {
"1" : [
"Mietgebühr",
"3,00 € / 1 Std "
],
"2" : [
"Gratiszeit",
"1 Std / Tag"
],
"4" : [
"Max. Gebühr",
"20,00 € / Tag"
]
},
"id" : "5519",
"name" : "Cargo-Bikes",
"rental_info" : {
"2" : [
"Tracking",
"Ich stimme der Speicherung (Tracking) meiner Fahrstrecke zwecks wissenschaftlicher Auswertung und Berechnung der CO2-Einsparung zu!"
]
}
},
"state" : "available",
"authed" : "1",
"description" : "Lastenrad Sabine",
"bike" : "WUE5525",
"lock_state" : "locked",
"station" : "WUE302",
"Ilockit_GUID" : "",
"bike_group" : [
"WUE300029"
],
"Ilockit_ID" : "00000000-0000-0000-0000-fc3c002a2add",
"uri_operator" : "https://shareeapp-op.example.tld",
"system" : "Ilockit",
"smartlock_type" : {
"engine" : {
"manufacturer" : "Ilockit"
},
"battery" : {
"charge_current_percent" : "37"
}
}
},
"LEC5522" : {
...
}
}
```