Welcome to Tesla Motors Club
Discuss Tesla's Model S, Model 3, Model X, Model Y, Cybertruck, Roadster and More.
Register
  • We just completed a significant update, but we still have some fixes and adjustments to make, so please bear with us for the time being. Cheers!

Model S REST API

rdrcrmatt

Member
Jun 27, 2013
607
31
Milwaukee
That's ok now I can successfully get a 90 days token with curl :D
With the new api on https://owner-api.teslamotors.com/oauth/token

Now I need to see how to use this token when calling API urls


I know Tesla's internal sites can see pack temp, CAC (estimated), and other awesome things. there must be a way for us to get them too if only we had the queries.

I wish there was something we could do to see in the traffic the car is putting on my wifi without the key for the openvpn connection.
 

hans

P631
Sep 27, 2012
1,132
13
Menlo Park
Does anyone know the full HTTP header sent by the official Tesla mobile apps? In particular any standard or custom header properties beyond just "Content-Type' and 'Authentication' discussed already. PM me if you would rather discuss in private.
 

jpasqua

P19325
Feb 19, 2013
696
4
New field in Charge State in 6.1

I got 6.1 today and noticed a new field in the charge state: motorized_charge_port

It's possible it was there prior to this, but I just noticed it today. It's a boolean.
 

jpasqua

P19325
Feb 19, 2013
696
4
How can I access things like odometer, FW version, and other things that VisibleTesla displays, but is not listed here: Tesla Model S JSON API—by apiary.io

Most things are documented at either or both of apiary.io and a google doc titled "Tesla Model S Remote Access Protocol". The odometer reading is only available through the streaming API (don't ask me why). You can read about it in the google doc I just mentioned.

Another easy thing to do is look at the source code of one of the existing apps or libraries. This page gives links to code in Python, JavaScript, Java, C#, Ruby, and PHP.

Hope that helps.
 

pvandorp

New Member
Jan 21, 2015
2
0
Rhoon, Netherlands
Does anyone else experience issues at the moment (as of yesterday) with logging in? When I do curl -k -c cookies.txt -d "user_session=USERNAME&user_session[password]=PASSWORD" https://portal.vn.teslamotors.com/login[/I]I get a HTTP 500 response. Existing session do keep working, but I assume that is due to the fact that the cookie is valid for 30 days.

I read something about using OAuth to connect. Anyone care to share how this is done?

With kind regards,

Patriek
 

pvandorp

New Member
Jan 21, 2015
2
0
Rhoon, Netherlands
Question about OAuth tokens

That's ok now I can successfully get a 90 days token with curl :D
With the new api on https://owner-api.teslamotors.com/oauth/token

Now I need to see how to use this token when calling API urls

Would you like to share how you did this? I'm currently having technical issues with the plain text username/password approach (apart from the moral issues I have with it).

With kind regards,

Patriek
 

hans

P631
Sep 27, 2012
1,132
13
Menlo Park
I am playing around with my NEST Thermostat and it is amazing the similarity to what has been going on with this community. People at first decoded the protocol and make unofficial APIs just as everyone here has done. Now Google has a NEST Developer Program with sample code and a proper OAuth 2.0 authentication system for allowing users to approve third party "Partner Developer Services" to be able to access the NEST resource servers.

Hey Tesla look over here!

Detailed authorization data flow | Nest Developer Program
 

apacheguy

S Sig #255
Oct 21, 2012
5,071
1,238
So Cal
Doesn't the NEST encrypt all traffic to the cloud? So it's not a local API right? I mean, the same can be said of the MS, but when I was looking to buy a new thermostat they didn't even have an API. That was a deal breaker for me so I bought a radio thermostat and haven't looked back since. Oh and it was half the price of the NEST at the time.

I think Tesla will get around to this eventually, though it's probably not high on their list of priorities.
 

hans

P631
Sep 27, 2012
1,132
13
Menlo Park
Doesn't the NEST encrypt all traffic to the cloud? So it's not a local API right? I mean, the same can be said of the MS [...]

Exactly. Google are control freaks just like Tesla so all the traffic from their devices (Thermostat, Smoke detector, Dropcam) to their servers in the cloud are encrypted and they do not provide official local APIs. Hackers have figured it out and there are unofficial NEST API in a dozen languages, but NEST has no intention of enabling anyone to integrate without going through their managed APIs in the cloud, joining their developer program, complying with their terms and conditions, etc.

Tesla could do this as well for the types of apps we have been writing using the REST and streaming endpoints. They have everything they need in place. I checked a few of the standard OAUTH 2.0 URLs and parameters and they seem to work. They just need to expose a Web Page to register third party apps, assign client ids, client secret, and a redirect URI (or a PIN) for allowing the users to approve the third party apps.

The SDK for the car is something different because it would run locally on the console, likely in a sandbox, but with some (optional) access to the cars subsystems for bluetooth, navigation, the dashboard display, etc. These apps unfortuately must be tightly controlled (i.e. approved) by Tesla to comply with government regulations and ensure safety. This is a much larger effort to setup this kind of a developer program because it requires Tesla to setup a Tesla App Store, and dedicate people to an application approval process for the candidate apps. They also need to build a bulletproof sandbox on the car or they risk negative press about some rogue app taking over control.

I figure, Tesla will walk before they run so I hope to hear about a developer program with OAuth 2.0 authentication of registered third party apps and a REST and Streaming REST API that pretty much matches what we already know.
 
Last edited:

jpasqua

P19325
Feb 19, 2013
696
4
I've heard from a P85D owner that he has parking assist, but it's not showing up as an option from the vehicle data. Do all Model Ss after a certain point come with parking assist? Is it not listed as an option for those cars because it is now standard?
 

Olen

Member
Oct 9, 2013
97
0
I've heard from a P85D owner that he has parking assist, but it's not showing up as an option from the vehicle data. Do all Model Ss after a certain point come with parking assist? Is it not listed as an option for those cars because it is now standard?
It is standard for cars produced after November (?) 2014.
 

About Us

Formed in 2006, Tesla Motors Club (TMC) was the first independent online Tesla community. Today it remains the largest and most dynamic community of Tesla enthusiasts. Learn more.

Do you value your experience at TMC? Consider becoming a Supporting Member of Tesla Motors Club. As a thank you for your contribution, you'll get nearly no ads in the Community and Groups sections. Additional perks are available depending on the level of contribution. Please visit the Account Upgrades page for more details.


SUPPORT TMC
Top