Page 1 of 4

Bird Scooter API (successful response using Postman)

Posted: Mon Aug 20, 2018 9:55 pm
by Edmund
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
},

Re: Bird API

Posted: Tue Aug 21, 2018 7:32 am
by Nottinghaam
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.

Re: Bird API

Posted: Tue Aug 21, 2018 6:48 pm
by Edmund
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.
To view images REGISTER or LOGIN for full access.

Re: Bird API

Posted: Tue Aug 21, 2018 8:08 pm
by Nottinghaam
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.

Re: Bird API

Posted: Tue Aug 21, 2018 9:20 pm
by Edmund
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
To view images REGISTER or LOGIN for full access.


Magic Link Token
To view images REGISTER or LOGIN for full access.

Re: Bird API

Posted: Tue Aug 21, 2018 11:24 pm
by Nottinghaam
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.

Re: Bird API

Posted: Thu Aug 23, 2018 7:15 pm
by Edmund
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.

Re: Bird API

Posted: Fri Aug 24, 2018 12:18 pm
by cpbergie
Could there be another api or header for the birds that need charging? Technically a charger would be able to search for both.

Re: Bird API

Posted: Fri Aug 24, 2018 1:47 pm
by Nottinghaam
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.

Re: Bird API

Posted: Fri Aug 24, 2018 4:00 pm
by cpbergie
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 ?