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

apacheguy

S Sig #255
Oct 21, 2012
5,071
1,238
So Cal
Apologies if I missed this. Has the streaming API changed within the past couple years? It doesn't seem to return anything (content length 0) for me:

Code:
> GET /stream/xyxyxyxyxyx/?values=speed,power HTTP/1.1
> Host: streaming.vn.teslamotors.com
> Authorization: Basic xyxyxyxyxyxyxyx
> User-Agent: curl/7.42.1
> Accept: */*
>
* SSLv2, Unknown (23):
< HTTP/1.1 200 OK
< Server: nginx
< Date: Tue, 12 Jun 2018 04:22:17 GMT
< Content-Type: text/event-stream
< Content-Length: 0
< Connection: keep-alive
< Cache-Control: no-cache
<
* Connection #0 to host streaming.vn.teslamotors.com left intact
 

apacheguy

S Sig #255
Oct 21, 2012
5,071
1,238
So Cal
Bump. Anyone?

Here is the exact curl command I am using to diagnose:

Code:
curl -v --user USR:TOKEN -H "Accept: */*" https://streaming.vn.teslamotors.com/stream/xyxyyxyxyxy/?values=speed,odometer,elevation,soc
 

pjw65

Member
Mar 19, 2016
208
144
Switzerland
This works for me:
Code:
Vehicle: tokens=[u'123456789abcdef0', u'1234123412341234']
VEHICLE_TOKEN='123456789abcdef0'
curl --user "$TESLA_EMAIL:$VEHICLE_TOKEN" "https://streaming.vn.teslamotors.com/stream/$VEHICLE_ID/?values=speed,odometer,soc,elevation,est_heading,est_lat,est_lng,power,shift_state"
 

josebet1

New Member
Jun 15, 2018
4
3
Austin, TX
Can't get the streaming api to work either on Model 3 (2018.21.9 75bdbc11)

Looking through the APK, I found a "new" streaming endpoint:
Code:
StreamingServerEndpoints={LOCATION_STREAMING:"streaming/",AUTOPARK_SUMMON:"connect/"}

but I am unable to connect, server seems to not be able to connect to the car.

Code:
{"msg_type":"data:error","tag":"${vehicle_id}","value":"disconnected","error_type":"vehicle_disconnected"}

If anyone wants to try the new endpoint on their Model S or X I can send some sample code over
 

apacheguy

S Sig #255
Oct 21, 2012
5,071
1,238
So Cal
Sorry, should’ve mentioned that I’m trying this on a Model 3. Not sure if that matters.

The PowerTools app uses the streaming API AFAIK. How come this works and our curl commands do not?
 

josebet1

New Member
Jun 15, 2018
4
3
Austin, TX
Sorry, should’ve mentioned that I’m trying this on a Model 3. Not sure if that matters.

The PowerTools app uses the streaming API AFAIK. How come this works and our curl commands do not?

Have you tried the PowerTools app with your Model 3? I briefly tried it on my Model 3, and it didn't seem to work.
 

HankLloydRight

No Roads
Jan 18, 2014
12,821
10,834
Connecticut
Ok, I posted about my Javascript API Token Generator in this thread: Tesla API Token Generator

But I've been working on enhancing it a lot tonight. Basically, it injects a Javascript script using Tampermonkey onto the https://owner-api.teslamotors.com/oauth/token domain. So in effect, all the code is running in your local browser talking directly to the Tesla API endpoints over https. No middleman or other websites or servers to worry about. No need to install Python, Ruby, PHP, Postman, CURL, etc or learn or use the OSX or linux command line.

This method only has one requirement: Install the Tampermonkey browser extension in Chrome or Firefox. You can then install my script from this page with one click: About | Telsa API Token Generator | Userscripts | OpenUserJS Once installed, just go to: https://owner-api.teslamotors.com/oauth/token to get started and the script will do its thing.

All the code is right there in Javascript/jquery for your review/inspection. Once you login, you can view all the cars on your Tesla Account, and then pull the /data endpoint for each one.

It's pretty basic at this point, but if you want to just play around and see what the API returns for your car, I think this is probably the easiest way for people to jump in and browse the API information. Or say if you're away from your own server or API code, this is browser-only code that you can safely run from anywhere.
 

wayner

Active Member
Oct 29, 2014
3,804
1,382
Toronto
Just dig through the thread.
Its a gold mine of information. If you want something that's already been posted you can try search for it.
Seriously? Comb through 2300 posts looking for the ones that may be relevant? We really do not someone to keep the API docs updated.
 

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