An Electric Scooter Community on a Mission to Stamp out Transportation Mediocrity.

Fly with the flock
#362
Over the weekend I began messing around with the Bird API and finally got a successful response with Post Man. I used this Github post as a guide and Bird provided all of the scooters available to ride within a certain radius.

This is pretty slick but I'm left wanting to do way more. Any ideas how I can find out other commands to send to the Bird API?

Here is a sample of the response from the Bird API.
{
"birds": [
{
"location": {
"latitude": 33.812580000000004,
"longitude": -84.37371
},
"id": "5340bd4d-86e2-49e7-be30-2940f4b77377",
"code": "S6HW",
"battery_level": 67
},
User avatar
By Nottinghaam
#364
Here's a list of the endpoints I've found so far:

/user/login [method=GET]
/config [method=GET]
/contractor [method=GET]
/order/eligible [method=GET]
/order/current [method=GET]
/product/power-supplies [method=GET]
/bird/nearby [method=GET]
/bird/task [method=GET]
/ride/last [method=GET]
/bird/alarm [method=PUT]
/task/complete [method=PUT]

Each has its own required headers and bodies but all will need an Authorization header and Device-Id header at least.
User avatar
By Edmund
#365
Nottinghaam wrote:
Tue Aug 21, 2018 7:32 am
Here's a list of the endpoints I've found so far:

/user/login [method=GET]
/config [method=GET]
/contractor [method=GET]
/order/eligible [method=GET]
/order/current [method=GET]
/product/power-supplies [method=GET]
/bird/nearby [method=GET]
/bird/task [method=GET]
/ride/last [method=GET]
/bird/alarm [method=PUT]
/task/complete [method=PUT]

Each has its own required headers and bodies but all will need an Authorization header and Device-Id header at least.
Very helpful, thank you. I noticed when using the /bird/nearby endpoint it would only return scooters on the rider map. Have you figured out how to get a response for scooters from the charger and/or mechanic map?

Here is a screenshot of the PostMan Get request I sent.
Image
User avatar
By Nottinghaam
#367
BirdWatcher wrote:
Tue Aug 21, 2018 6:48 pm
Very helpful, thank you. I noticed when using the /bird/nearby endpoint it would only return scooters on the rider map. Have you figured out how to get a response for scooters from the charger and/or mechanic map?

My guess is that you are using a different email address and device ID for authorization than what you use in the Bird App. The account you authorize needs to be a charger or a mechanic to see those details.
User avatar
By Edmund
#369
Nottinghaam wrote:
Tue Aug 21, 2018 8:08 pm
My guess is that you are using a different email address and device ID for authorization than what you use in the Bird App. The account you authorize needs to be a charger or a mechanic to see those details.
Yep, you are correct. I used a made up email address to get the token.

When I use my charger email address the response below is returned without the token. A "Magic Link" email is sent to my email address that has a token but it's way to short. Any ideas?

Post Request
Image

Magic Link Token
Image
User avatar
By Nottinghaam
#375
BirdWatcher wrote:
Tue Aug 21, 2018 9:20 pm
When I use my charger email address the response below is returned without the token. A "Magic Link" email is sent to my email address that has a token but it's way to short. Any ideas?

That's the sort of tricky part... Since you already have a token generated for your account then the response from the POST request doesn't contain the token, it just refreshes the expiration date of the token. Only the first time a token is generated is it included in the response.

If you want to access your own account through the API in this method then you'll have to get your token. To do this you'll have to sniff the HTTP requests from the Bird App.

There may be another way to generate a new token but I haven't tested anything yet.
User avatar
By Edmund
#380
I'll keep trying to find a way to show the token through the API. I like the sniffing idea and will use it for testing.
By cpbergie
#385
Could there be another api or header for the birds that need charging? Technically a charger would be able to search for both.
User avatar
By Nottinghaam
#386
The endpoint /bird/nearby shows ridable scooters and the endpoint /bird/task shows tasks for chargers (possibly mechanics as well). In order to access the /bird/task endpoint you must have an authorization token associated with an account that is a registered charger (or mechanic).

An authorization token is generated at first login so that the /user/login endpoint responds with and "id" and a "token". After the initial login only "id" and "expires_at" is contained in the response from the /user/login endpoint.

If you want to access the /bird/task endpoint you need a token that belongs to a charger or mechanic account. Since you've already logged in with that account your token has already been generated and /user/login will not respond with the token again (unless there is some case that results in a new token being generated).

The only way I am sure you can obtain your token is by sniffing the headers in the request from the Bird App. It is possible that scootermap.com has found a different way to do this or they are simply using one existing charger account for all users that access the page.
By cpbergie
#389
Thanks for the info. Got those APIs to work. I'm going to try and find my token somehow. I'm guessing scootermap is using the same charger token for everyone.

Do you know the header info for last/ride ?

As this was a rental version whos overstock was […]

Any one got any info on beryl bikes I seen a few[…]

LH/ TF-100 Style Display.

Hi I recently converted a Bird Zero to a personal […]

How do you operate dash without button? I have[…]