ubahnverleih / WoBike

Documentation of Bike Sharing APIs 🚴🛴🛵
958 stars 131 forks source link

Completeness of Nextbike data? #38

Open PellelNitram opened 6 years ago

PellelNitram commented 6 years ago

I am experimenting with the Nextbike data right now.

Digging through the data, I noticed that the maximal number of bikes at a given location and time for two tested cities does not exceed 5. That's very suspicious since there should be stations that have more than 5 bikes.

This raises the question if the data is reliable by any means.

Does anybody maybe have some information on what is published under the Nextbike API? Is the really the full data?

ubahnverleih commented 6 years ago

Thats right. 5 means now 5 or more than 5. (some month ago they had a 5+ to indicate that there are more. But there is a request to get all bikes from one station. I will try to find that request.

PellelNitram commented 6 years ago

Wow, thanks for your blazingly fast reply! Amazing!

May I ask a follow up question: What do you mean by request? An implemented feature to access the available data, e.g. an additional query to the API, or do speak of a discussion with Nextbike to ask them if they could provide that information again?

ubahnverleih commented 6 years ago

Request for get all bikes at station is: https://api.nextbike.net/api/getBikeList.json?place=310790&apikey=TR6EHaaNTSFGFmMt

hope this helps. response looks like this

{"server_time":1532466029,"items":[{"node":"bike","number":"93440","language":"de","boardcomputer":1270,"battery":15,"snap":0,"target_firmware":"0e050d01","target_configuration":"","electric_lock":false,"gps_tracking":false,"rfid":0,"rfid_uid":0,"bluetooth_mac":null,"state":"ok_but_unknown_number","bike_type":0,"lock_types":["analog_code_lock"],"active":true,"app_campaign_picture":"","app_campaign_picture_link":"","app_campaign_uid":0,"campaign_name":"Eigenwerbung SZ","target_whitelist":"","pedelec":false,"pedelec_battery":0,"time_to_charge":0,"place_id":310790,"city_id":2,"bike_domain":"sz","domain":"sz"},{"node":"bike","number":"93470","language":"de","boardcomputer":0,"battery":0,"snap":0,"target_firmware":"","target_configuration":"","electric_lock":false,"gps_tracking":false,"rfid":0,"rfid_uid":0,"bluetooth_mac":null,"state":"ok_but_unknown_number","bike_type":0,"lock_types":["analog_code_lock"],"active":true,"app_campaign_picture":"","app_campaign_picture_link":"","app_campaign_uid":0,"campaign_name":"Eigenwerbung SZ","target_whitelist":"","pedelec":false,"pedelec_battery":0,"time_to_charge":0,"place_id":310790,"city_id":2,"bike_domain":"sz","domain":"sz"},{"node":"bike","number":"93523","language":"de","boardcomputer":0,"battery":0,"snap":0,"target_firmware":"","target_configuration":"","electric_lock":false,"gps_tracking":false,"rfid":0,"rfid_uid":0,"bluetooth_mac":null,"state":"ok_but_unknown_number","bike_type":15,"lock_types":["analog_code_lock"],"active":true,"app_campaign_picture":"","app_campaign_picture_link":"","app_campaign_uid":0,"campaign_name":"Eigenwerbung SZ","target_whitelist":"","pedelec":false,"pedelec_battery":0,"time_to_charge":0,"place_id":310790,"city_id":2,"bike_domain":"sz","domain":"sz"},{"node":"bike","number":"93641","language":"de","boardcomputer":0,"battery":0,"snap":0,"target_firmware":"","target_configuration":"","electric_lock":false,"gps_tracking":false,"rfid":0,"rfid_uid":0,"bluetooth_mac":null,"state":"ok_but_unknown_number","bike_type":15,"lock_types":["analog_code_lock"],"active":true,"app_campaign_picture":"","app_campaign_picture_link":"","app_campaign_uid":0,"campaign_name":"Mobilit\u00e4tskampagne LHDresden","target_whitelist":"","pedelec":false,"pedelec_battery":0,"time_to_charge":0,"place_id":310790,"city_id":2,"bike_domain":"sz","domain":"sz"},{"node":"bike","number":"93370","language":"de","boardcomputer":1414,"battery":98,"snap":0,"target_firmware":"0e050d01","target_configuration":"","electric_lock":false,"gps_tracking":false,"rfid":0,"rfid_uid":0,"bluetooth_mac":null,"state":"ok_but_unknown_number","bike_type":0,"lock_types":["analog_code_lock"],"active":true,"app_campaign_picture":"","app_campaign_picture_link":"","app_campaign_uid":0,"campaign_name":"Eigenwerbung SZ","target_whitelist":"","pedelec":false,"pedelec_battery":0,"time_to_charge":0,"place_id":310790,"city_id":2,"bike_domain":"sz","domain":"sz"},{"node":"bike","number":"93550","language":"de","boardcomputer":0,"battery":0,"snap":0,"target_firmware":"","target_configuration":"","electric_lock":false,"gps_tracking":false,"rfid":0,"rfid_uid":0,"bluetooth_mac":null,"state":"ok_but_unknown_number","bike_type":0,"lock_types":["analog_code_lock"],"active":true,"app_campaign_picture":"","app_campaign_picture_link":"","app_campaign_uid":0,"campaign_name":"SZ Eigenwerbung Familienzeit","target_whitelist":"","pedelec":false,"pedelec_battery":0,"time_to_charge":0,"place_id":310790,"city_id":2,"bike_domain":"sz","domain":"sz"},{"node":"bike","number":"93316","language":"de","boardcomputer":1174,"battery":20,"snap":0,"target_firmware":"0e050d01","target_configuration":"","electric_lock":false,"gps_tracking":false,"rfid":0,"rfid_uid":0,"bluetooth_mac":null,"state":"ok_but_unknown_number","bike_type":0,"lock_types":["analog_code_lock"],"active":true,"app_campaign_picture":"","app_campaign_picture_link":"","app_campaign_uid":0,"campaign_name":"SZ Eigenwerbung Familienzeit","target_whitelist":"","pedelec":false,"pedelec_battery":0,"time_to_charge":0,"place_id":310790,"city_id":2,"bike_domain":"sz","domain":"sz"},{"node":"bike","number":"93232","language":"de","boardcomputer":1480,"battery":98,"snap":0,"target_firmware":"0e050d01","target_configuration":"","electric_lock":false,"gps_tracking":false,"rfid":0,"rfid_uid":0,"bluetooth_mac":null,"state":"ok_but_unknown_number","bike_type":0,"lock_types":["analog_code_lock"],"active":true,"app_campaign_picture":"","app_campaign_picture_link":"","app_campaign_uid":0,"campaign_name":"Eigenwerbung SZ","target_whitelist":"","pedelec":false,"pedelec_battery":0,"time_to_charge":0,"place_id":310790,"city_id":2,"bike_domain":"sz","domain":"sz"}]}

PellelNitram commented 6 years ago

Thanks, that query type looks very promising.

Is it safe to use that API key? I get nervous when seeing API keys in public but it might be intentionally.

ubahnverleih commented 6 years ago

i just grabbed this Key from the iOS App. I have no idea if they change it. But if so, just get it again from the app. If you only scrape data for analysis it should work, because it wouldn't be a disaster if they change it. Would be more a problem, if you use it in a consumer app, but than i guess you should contact nextbike anyway

PellelNitram commented 6 years ago

Wow, that's amazing!

One final question: Do you might know how to generalise the given API call to other "place" values? I tried to use the "number" of some location in some city, but that doesn't work. Or in other words: How to find the value for "place" that corresponds to some target location? E.g. what's the place value for some station in, say, Berlin.

ubahnverleih commented 6 years ago

the place/number is the uid of the station, you get in the nextbike-live.json response. If you only interested in the number of bikes, i just found you can also use this https://api.nextbike.net/api/findStation.json?api_key=TR6EHaaNTSFGFmMt&number=310790

(Wow, they have 3 different names for it: uid, place and number :D )

PellelNitram commented 6 years ago

That works like a charm! Thank you very much, I appreciate your help and work in form of this repo!

With these new API addresses at hand that require multiple API calls to get the full information, I am curious when the API is blocking my requests :-).

ubahnverleih commented 6 years ago

I reopen, because i would like to add this links to the Documentation

PellelNitram commented 6 years ago

That's a good idea!

Do you find even more API links from the iOS app?

xr0m3oz commented 6 years ago

Where can I see the entire list of Api?

Is it possible for Api to do the same as in the original application?

I want to make a new application and website for Ukraine. And it seems that the fact that he himself provided a bike is terrible.