Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register

Model S REST API

This site may earn commission on affiliate links.
Anybody have a Java client for the API working? I've got mine working fine with the Apiary API simulator, but when I try to run it against Tesla's, I get a 500 error and a nice "We're sorry, but something went wrong" message in HTML.

I'm curious why this works with the Apiary service, but not Tesla's. Accounting for the obvious differences in usernames and passwords, I was hoping it'd work.

I've got the python bindings to work from the command line, but I'm trying to make a nice UI for myself.

Any suggestions are helpful.


Thanks,

Doug
 
I think I've found the problem - I wasn't using the Inspector in Apiary, and it showed a glitch in the expected request info. I'll try again when I'm back home (darn work always keeps me from the really interesting stuff).
 
Thank you guys for all of the documentation. I created a C# library for the Tesla Model S API's. I can post a link if anyone wants to use it. I am still waiting for my car to arrive too can fully test it, but it seems to work using the Test API from the documentation website.

I am very excited about making apps for the Tesla!! What other car comes with developer API's?!

Would be great if you could post your work! :)
 
Would be great if you could post your work! :)

Here's a link to the project:
http://code.google.com/p/teslalib/

I have only been able to test it on the APIARY website. However, my Tesla is currently in production, so when I receive my Tesla, I will be able do a lot more testing!

If you have any suggestions feel free to tell me!

I also added a small application in the library named FieldAnalyzer. It should make it very easy to identify if there are any new/removed fields in future Tesla Firmware updates.

I am hoping for V 5.0 sometime around the when my Tesla should be delivered!
 
OK guys I'm not a computer programmer (except for some hobby stuff) so excuse me if this is stupid... but,

I have a Kreyos Smartwatch on order (you can pre-order one via a "donation" on indiegogo) and basically this is going to be a cool watch that will bluetooth to your smartphone and you'll be able to control a lot of functions on the phone via voice control or gestures (on the watch). Also a lot of data from the phone will be displayed on the watch, the watch will have apps etc. So anyway, what I think would be cool was if one could control functions of the car with the watch, for example a gesture to unlock doors, or voice command to open the rear hatch etc. Would this be doable, with your current functionality with the API are you able to create "bookmarks" or shortcuts on the phone where you just click one icon and the doors open (for example)?
 
OK guys I'm not a computer programmer (except for some hobby stuff) so excuse me if this is stupid... but,

I have a Kreyos Smartwatch on order (you can pre-order one via a "donation" on indiegogo) and basically this is going to be a cool watch that will bluetooth to your smartphone and you'll be able to control a lot of functions on the phone via voice control or gestures (on the watch). Also a lot of data from the phone will be displayed on the watch, the watch will have apps etc. So anyway, what I think would be cool was if one could control functions of the car with the watch, for example a gesture to unlock doors, or voice command to open the rear hatch etc. Would this be doable, with your current functionality with the API are you able to create "bookmarks" or shortcuts on the phone where you just click one icon and the doors open (for example)?

Very doable. I have a Pebble on order to do the same thing. Got the idea from a guy who hacked his old amazon kindle into a charge monitor display for his wall. It should be fairly simple to create gestures on a smart phone as well. Like shake to unlock or figure 8 to lock.
 
Very doable. I have a Pebble on order to do the same thing. Got the idea from a guy who hacked his old amazon kindle into a charge monitor display for his wall. It should be fairly simple to create gestures on a smart phone as well. Like shake to unlock or figure 8 to lock.

hans!!!!

I have a Pebble now and if you can write an app, that would be AMAZING!!! There is already an app called httpebble (for ios) that allows you to access internet services to pass through to the watch -- I have a watch face that displays the time and weather and uses httpebble.

Looking forward to seeing what you're able to do!

Aaron
 
Very doable. I have a Pebble on order to do the same thing. Got the idea from a guy who hacked his old amazon kindle into a charge monitor display for his wall. It should be fairly simple to create gestures on a smart phone as well. Like shake to unlock or figure 8 to lock.

If you're talking about my thread EInk display for power price and car status that was actually a new Kindle - had to get black to match the kitchen decor :)

Pebble watch would be great for notifications like "door ajar" and "charge interrupted"
 
If you're talking about my thread EInk display for power price and car status that was actually a new Kindle - had to get black to match the kitchen decor :)

Yup. That's the thread. Great idea Banahogg.

Pebble watch would be great for notifications like "door ajar" and "charge interrupted"

I was going to write a custom display to show the charge status, SOC, time left to charge completion, and maybe an alert for "wife driving too quickly" ;-)

It would also be nice to have a button to quickly turn on the climate control as I leave my office and head out to the parked car.
 
was a determination ever made as to whether the speed, odometer and range values were in miles or Km ?

All North American vehicles report distance units in miles via the API. The miles/km conversion is performed in the user interface. When Tesla starts shipping vehicles in other regions (e.g. Europe) I'll be curious to see if they stick with this method, but I imagine they probably will.
 
All North American vehicles report distance units in miles via the API. The miles/km conversion is performed in the user interface. When Tesla starts shipping vehicles in other regions (e.g. Europe) I'll be curious to see if they stick with this method, but I imagine they probably will.

It's funny how each subsystem is different. All the climate temperature values reported by the REST API are in Celsius. I had to convert them to Fahrenheit in my application.
 
Hi all - new to this group.

Was just wondering if anyone has any more insights on why, how, when the HVAC is going to sleep (and renders inside/outside temp to null) and what can be done to consistently wake it up without taking it for a spin.
I have my Tesla sitting here for a while and inside/outside temp went offline for a good while ... and now, suddenly it came back on.

By the way ... my inside temp is at 60°C - did I break any records with thatone ? :)
 
Hi all - new to this group.

Was just wondering if anyone has any more insights on why, how, when the HVAC is going to sleep (and renders inside/outside temp to null) and what can be done to consistently wake it up without taking it for a spin.
I have my Tesla sitting here for a while and inside/outside temp went offline for a good while ... and now, suddenly it came back on.

By the way ... my inside temp is at 60°C - did I break any records with thatone ? :)

Only way I know to absolutely guarantee that the inside and outside temp sensors are reporting values via the REST API is to turn the HVAC system on. You can turn climate control system right back off again (to conserve battery) and still continue to get temp readings for quite a while. I know of no other way to "wake up" these sensors remotely.
 
Only way I know to absolutely guarantee that the inside and outside temp sensors are reporting values via the REST API is to turn the HVAC system on. You can turn climate control system right back off again (to conserve battery) and still continue to get temp readings for quite a while. I know of no other way to "wake up" these sensors remotely.

I think I mentioned previously in this thread (or perhaps it was the Mobile App thread?) that toggling the Pano Roof vent open/closed will do it for me. It wakes up the interior temp reporting...
 
It's funny how each subsystem is different. All the climate temperature values reported by the REST API are in Celsius. I had to convert them to Fahrenheit in my application.

PureAmps & hans - thanks. i agree it is sort of odd some units are metric and others aren't. i hope that the API remains unit-consistent regardless of location (sales or otherwise)...although i suppose a client ought to be able to intuit whether the measurements are being repoted in miles or meters (let's hope it's not miles or kilometers!)
 
let's switch from APIs, per se, to algorithmic use of the API...

a constant refrain on the teslamotors forum is "why won't my model S page me when it's done charging". of course, if there was something monitoring the charging status of the the vehicle it could page the owner. let's assume we have a service running on an "always on" server (e.g., in the cloud, the enterprise, whatever), and lets also assume that there's an easy path to get a notification to the phone. here's my question for the API gurus:

what algorithm should the service use to determine that the vehicle has entered the charging state and when it has exited, either due to disconnect or full charge? are we talking something like this:

1. poll until charge_state.charging_state transitions to 'Charging' from some other state
2. poll until either charge_state.charging_state transitions to something other than 'Charging', then notify owner as to charge_state.battery_level and charge_state.battery_range

is it that simple or are there other corner cases to worry about?
 
Only way I know to absolutely guarantee that the inside and outside temp sensors are reporting values via the REST API is to turn the HVAC system on. You can turn climate control system right back off again (to conserve battery) and still continue to get temp readings for quite a while. I know of no other way to "wake up" these sensors remotely.

If I turn mine off via the API, then when I get in the car again it doesn't come back on; I have to turn it on manually. I wish turning it off via the API would put it back to the way it was when I left the car: off now but automatically back on when I open the door. I hope they will fix this.
 
I whipped up a java client library and some command line tools for testing. I wonder whether anyone has been able to amass a collection of images that depict the car in various states (e.g. pano roof open, plugged into charger, etc.). They'd be useful for displaying some of the output graphically.
 
I whipped up a java client library and some command line tools for testing. I wonder whether anyone has been able to amass a collection of images that depict the car in various states (e.g. pano roof open, plugged into charger, etc.). They'd be useful for displaying some of the output graphically.

I am not sure if this is against any copyright rules or just not exactly fair to Tesla, but I was able to extract all the images from the iPhone app. They are .PNG's which have images for all of the car colors and for each state of the car.

I am sure the Android app has the same images contained in it. Maybe you could try borrowing them from one of the mobile apps