Automatic PHP API

Screen Shot 2013-10-16 at 9.48.55 PM

I’m a big fan of Automatic. It’s a very cool widget that plugs into your car’s data port and will monitor your driving habits. It tracks your average MPG, alerts you if you accelerate too fast or brake too hard, and rolls all of its data into a simple weekly score – high your score the better you’re driving! It’s a super simple way to reinforce safe driving habits, and improve your fuel efficiency at the same time, very cool!

However, since the product is still so young, there’s no official REST API yet to access all of your own data. I tinker with QS and always want to have access to my data for all of the services I use. I’d love to be able to get my data out of the Automatic service, but since they don’t have an official API, I decided to figure out how the iOS app fetches data and see if I can piggy back on that to download and process my own data.

The result is the Unofficial Automatic PHP API:

[code lang=”php”]
// login to Automatic API
$automatic = new Automatic($username, $password);
// fetch trip data between the two input dates
$trips = $automatic->getTrips($start, $end);

The API so far lets you login and get your account and link information, get trip data, and get your weekly scores, information about your car, and even it’s parked location.

One thing to note, the username and password to use when logging into the API are not the same as what you use to login to the app. I’ve documented on the wiki how to find your API username and password.


4 thoughts on “Automatic PHP API

  1. Thanks for the good work reverse-engineering the automatic API’s so far!

    In the JSON output for the “trips” API call, do you have any idea what format the “path” key/value text is?

    It doesn’t seem to be obviously encoded (base64 or the like), or to be a data-url-encoded image of the map.

  2. I’ve been looking closer at the path value could be today, but I can’t seem to make heads or tails of it either. I’m assuming that they’re using Apple maps for their iOS app, and that path data is probably some sort of serialized MKPolyline. Those polylines appear to contain arrays of either float or doubles for the lat/long.

    I’ve tried a few different things to get meaningful data out of that string, but so far no luck. Just raw converting those bytes to floats/doubles doesn’t seem to show anything meaningful (assuming my code was right… types in PHP aren’t terribly clear sometimes). I’m at a loss as well.

  3. Cool work. I’ve been looking for something like this. If I get a chance I’m going to port it to Python, since that’s what I’m familiar with. So far I’ve been logging my trips into a Google spreadsheet – tedious!

Leave a Reply

Your email address will not be published. Required fields are marked *