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.
New charging value as of 1.51.94

New charging value as of 1.51.94.

fast_charger_type=ChargerTypeTesla (it is plugged into my HPWC)

my complete vehicle charging list is:
charging_state=Complete
charge_limit_soc=90
charge_limit_soc_std=90
charge_limit_soc_min=50
charge_limit_soc_max=100
charge_to_max_range=FALSE
battery_heater_on=NULL
not_enough_power_to_heat=FALSE
max_range_charge_counter=NULL
fast_charger_present=FALSE
fast_charger_type=ChargerTypeTesla
battery_range=230.88
est_battery_range=167.66
ideal_battery_range=267.09
battery_level=87
usable_battery_level=87
battery_current=NULL
charge_energy_added=6.94
charge_miles_added_rated=23.5
charge_miles_added_ideal=27
charger_voltage=NULL
charger_pilot_current=80
charger_actual_current=NULL
charger_power=NULL
time_to_full_charge=NULL
charge_rate=NULL
charge_port_door_open=1
scheduled_charging_start_time=NULL
scheduled_charging_pending=FALSE
user_charge_enable_request=NULL
charge_enable_request=1
eu_vehicle=FALSE
charger_phases=NULL
 
Just a little odd that something as relatively static as ODO would be limited to the streaming interface. Unless one is on the autobahn the ODO changes at around once every 45s.

I was surprised by this too. I can see why they include it in the streaming api, but having it in the drive_state would be useful.drive_state also contains gps coords and speed, so having odometer doesn't seem like it would be a stretch.
 
I was surprised by this too. I can see why they include it in the streaming api, but having it in the drive_state would be useful.drive_state also contains gps coords and speed, so having odometer doesn't seem like it would be a stretch.

There are quite a few aspects of the API that indicate that it was designed rather, err, quickly. The distribution of information is rather poorly laid out, the streaming methodology used is rather poor and of course there's the authentication.
I have tried repeatedly to get them to enter a conversation into how to improve the next version but have been rather strongly rebuffed each time.
 
Code:
[FONT=Andale Mono]$ heartbleed https://www.teslamotorsclub.com
[/FONT][FONT=Andale Mono]2014/04/19 17:09:38 www.teslamotorsclub.com - SAFE[/FONT]
[FONT=Andale Mono]
[/FONT]
[FONT=Andale Mono]$ heartbleed https://[/FONT][FONT=Andale Mono]streaming.vn.teslamotors.com[/FONT]
[FONT=Andale Mono]2014/04/19 17:11:31 streaming.vn.teslamotors.com - SAFE

[/FONT]
[FONT=Andale Mono]$ heartbleed [COLOR=#000000]h[/COLOR][COLOR=#000000]t[/COLOR]tps://[/FONT][FONT=Andale Mono]portal.vn.teslamotors.com[/FONT]
[FONT=Andale Mono]2014/04/19 17:11:43 portal.vn.teslamotors.com - ERROR: heartbleed: timeout[/FONT]

Something has changed because the last time I checked all three Tesla HTTPS URLs reported "timeout".
Now the main website and the streaming URL report "SAFE" from the Heartbleed OpenSSL bug.
REST API URL is still inconclusive.
 
Anyone know what has changed with the streaming api? I'm no longer getting an array of data when the car is parked and awake.

I am still getting data. I did notice that the HTTP long poll interval changed from 2 minutes to 5 minutes but I think that change was made a while ago. If you are only waiting for 120 seconds on a poll and expecting data then just try waiting longer and you should see something.
 
I am still getting data. I did notice that the HTTP long poll interval changed from 2 minutes to 5 minutes but I think that change was made a while ago. If you are only waiting for 120 seconds on a poll and expecting data then just try waiting longer and you should see something.

I've been relying on streaming.js and for some reason data isn't being deposited into the database. You're right I do see data coming in on command line. Are you still getting data put in mongo?
 
I've been relying on streaming.js and for some reason data isn't being deposited into the database. You're right I do see data coming in on command line. Are you still getting data put in mongo?

I am. I have been running streaming.js on Heroku (for free) for many weeks and it's been putting the data into mongodb hosted at MongoLabs (also for free) continuously.
 
OK, apologies again - maybe I'm thick-headed here. I can curl and get tokens and get the car to talk to me, but does anyone already have a script that automatically refreshes the tokens without interrupting the streaming data feed?

Ideally I'd like to be able to say "stream data from my car for the next XXX minutes, and dump it to a CSV file named YYY". This seems like it should be simple enough, but I haven't found the magic words yet... (I'm doing this on a very basic linux VPS, so I'm trying to work strictly within BASH/curl for the tools)...

Apologies for the question, as the answer might well be somewhere in the 800 posts in this thread but I couldn't find it easily. I'm looking for an explanation (or even better, an example) of how to periodically refresh the tokens using curl so that you can stream data indefinitely. I've got enough programming background to understand all the control flow, etc - it's just not entirely clear how you do the token refresh/cycling/whatever part.

And since I don't have my car (yet!) I can't actually test it to figure out what it does...

if anyone has a script (perl, python, bash) that implements this, I'm sure it will become obvious as soon as I see the code. ;-)
 
OK, apologies again - maybe I'm thick-headed here. I can curl and get tokens and get the car to talk to me, but does anyone already have a script that automatically refreshes the tokens without interrupting the streaming data feed?

Ideally I'd like to be able to say "stream data from my car for the next XXX minutes, and dump it to a CSV file named YYY". This seems like it should be simple enough, but I haven't found the magic words yet... (I'm doing this on a very basic linux VPS, so I'm trying to work strictly within BASH/curl for the tools)...

I'm sure it's possible to do this entirely in a bash shell script but i don't know that anyone has written one yet and it would be a lot more work than simply installing one of the existing tools that already produces steaming data into a CSV file.