Skip to content

Latest commit

 

History

History
142 lines (118 loc) · 7.44 KB

Sharedmobility.ch-API.md

File metadata and controls

142 lines (118 loc) · 7.44 KB

Access sharedmobility.ch data using the REST API

The data of the GBFS-endpoint of sharedmobility.ch can be accessed with a RESTful API. Here we show you some examples how to query the API.

General information

Available endpoints

GET attributes

Use the attributes endpoint to receive a list with available filters for find and identify endpoints.

E.G: Get all available attributes

https://api.sharedmobility.ch/v1/sharedmobility/attributes

Available attributes:

Attribute Description
ch.bfe.sharedmobility.provider.id Provider Id according to providers.csv
ch.bfe.sharedmobility.pickup_type System mode (free_floating or station_based)
ch.bfe.sharedmobility.vehicle_type Vehicle type of a system

Attributes to query station_based systems:

Attribute Description
ch.bfe.sharedmobility.available Availability of a station
ch.bfe.sharedmobility.station.id Id of a station
ch.bfe.sharedmobility.station.postcode ZIP code of a station. Note that not all stations have postcode information
ch.bfe.sharedmobility.station.region.id Id of a systems regions. Note that not all systems have region information
ch.bfe.sharedmobility.station.status.installed If true a station is installed on the street
ch.bfe.sharedmobility.station.status.renting If true a station is renting vehicles. Even if the station is empty

Attributes to query free_floating systems:

Attribute Description
ch.bfe.sharedmobility.vehicle.status.disabled If true a vehicle is currently disabled
ch.bfe.sharedmobility.vehicle.status.reserved If true a vehicle is currently reserved

GET find

Use the find endpoint for a fulltext search in station name and station address.

E.G: Get all stations with station name "ETH Hönggerberg"

https://api.sharedmobility.ch/v1/sharedmobility/find?
searchText=ETH Hönggerberg
&searchField=ch.bfe.sharedmobility.station.name
&offset=0
&geometryFormat=esrijson

E.G: Get all stations from provider "Rent_a_bike" with station name "Bahnhof"

https://api.sharedmobility.ch/v1/sharedmobility/find?
filters=ch.bfe.sharedmobility.provider.id=rent_a_bike
&searchText=Bahnhof
&searchField=ch.bfe.sharedmobility.station.name
&offset=0
&geometryFormat=esrijson

E.G: Get all stations with E-Bikes from provider "publiebike" with station name "Mittelstrasse"

https://api.sharedmobility.ch/v1/sharedmobility/find?
filters=ch.bfe.sharedmobility.vehicle_type=E-Bike
&filters=ch.bfe.sharedmobility.provider.id=publiebike
&searchText=Mittelstrasse
&searchField=ch.bfe.sharedmobility.station.name
&offset=0
&geometryFormat=esrijson 

GET identify

Use the identify endpoint for spatial queries.

E.G: Get all available vehicles which are within 200m around point 8.72334 47.50024

https://api.sharedmobility.ch/v1/sharedmobility/identify?
Geometry=8.72334,47.50024
&Tolerance=200
&offset=0
&geometryFormat=esrijson

E.G: Get all available E-Scooter which are within 500m around point 8.72334 47.50024

https://api.sharedmobility.ch/v1/sharedmobility/identify?
filters=ch.bfe.sharedmobility.vehicle_type=E-Scooter
&Geometry=8.72334,47.50024
&Tolerance=500
&offset=0
&geometryFormat=esrijson

E.G: Get all available station-based E-Bikes which are within 5000m around 7.57699,47.55352

https://api.sharedmobility.ch/v1/sharedmobility/identify?
filters=ch.bfe.sharedmobility.vehicle_type=E-Bike
&filters=ch.bfe.sharedmobility.pickup_type=station_based
&Geometry=7.57699,47.55352
&Tolerance=5000
&offset=0
&geometryFormat=esrijson

Note: You can use the SearchServer of the GeoAdmin API to get the coordinates of an address (see step 1 of GeoAdmin documentation).

GET providers

Use the providers endpoint to get details about shared mobility providers.

E.G: Get a list of all providers

https://api.sharedmobility.ch/v1/sharedmobility/providers

E.G: Get details of provider donkey_thun

https://api.sharedmobility.ch/v1/sharedmobility/providers/donkey_thun

Note: Provider_id is according to providers.csv

GET regions

Use the regions endpoint to get details about shared mobility regions.

E.G: Get a list of all regions

https://api.sharedmobility.ch/v1/sharedmobility/regions

E.G: Get details of region emobility:968

https://api.sharedmobility.ch/v1/sharedmobility/regions/emobility:968

Note that not all systems have region information