irwinr
Posts: 13
Joined: Thu Mar 26, 2015 8:20 am
Delivery Date: 26 Mar 2015

Re: Carwings API?

Tue Oct 13, 2015 10:38 am

Has anyone gotten this to work since the migration to the "NissanConnect EV" service? The old API calls don't seem to be working for me anymore.

-Jeremy

Computerizer
Posts: 189
Joined: Fri Dec 21, 2012 2:13 pm
Delivery Date: 19 Dec 2012
Location: Bellingham, WA, US

Re: Carwings API?

Tue Oct 13, 2015 12:46 pm

irwinr wrote:Has anyone gotten this to work since the migration to the "NissanConnect EV" service? The old API calls don't seem to be working for me anymore.

-Jeremy


I thought said it works as long as you use your new login you have to create. The Nissan Leaf app was not updated as a part of the change to NissanConnect EV, so it's using the same interface it was using before.
Tyrel Haveman
Founder of North Sound Electric Vehicle Association
2013 LEAF SL (Brilliant Silver); Prev: 2016 Kia Soul EV+ (Titanium Grey); 2013 LEAF SV (Blue Ocean), 2012 LEAF SL (Glacier Pearl)
100% Solar PV (12.125 kW ground-mount)
Bellingham, WA

irwinr
Posts: 13
Joined: Thu Mar 26, 2015 8:20 am
Delivery Date: 26 Mar 2015

Re: Carwings API?

Tue Oct 13, 2015 1:21 pm

The app actually was updated, I specifically remember being prompted to update at the beginning of October, but you could be right, the old interface may still supposedly work. It's just not working for me using either my new username nor my old username, and I'm not sure if it's something on Nissan's side or mine.

I actually just finished setting up mitmproxy to intercept the traffic, and the updated Nissan LEAF app actually uses a slightly different URL (It has "v3" in it now). It's not using the same URL it used before.

But even using the new URL, if I copy paste the XML into a curl request:

Code: Select all

$  curl -d@login3.xml https://nissan-na-smartphone-biz.viaaq.com/aqPortal/v3/smartphoneProxy/userService
<html><head><title>JBossWeb/2.0.0.GA_CP05 - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 401 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Status report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>This request requires HTTP authentication ().</u></p><HR size="1" noshade="noshade"><h3>JBossWeb/2.0.0.GA_CP05</h3></body></html>


But there's no HTTP_USER or HTTP_PASSWORD being passed according to mitmproxy, so I'm not sure why it's saying it needs HTTP auth when the app is clearly not using it.

irwinr
Posts: 13
Joined: Thu Mar 26, 2015 8:20 am
Delivery Date: 26 Mar 2015

Re: Carwings API?

Wed Oct 14, 2015 7:47 am

Just in case anyone else is working on this: I noticed that there is an extra HTTP Header that I didn't notice before in the initial login called "AppToken". It's a base64 encoded version of this:

Code: Select all

SmartPhoneKeyVersion=1;SmartPhoneType=ANDROID;UUID=<my Phones UUID>


So it seems this header has to be added to any requests and it treats it as the "authentication":

There is also another header called AccessKeyID:

Code: Select all

AccessKeyID:      A1r619u1ty!


BOTH of these new headers have to be present to access the new service.

-Jeremy

IIama
Posts: 11
Joined: Wed Dec 16, 2015 8:51 am
Delivery Date: 16 Dec 2015

Re: Carwings API?

Wed Dec 16, 2015 8:55 am

Jeremy,

Can you please post a trace of the login/command process? I'm having trouble myself now, so having a trace (personal info removed) would allow me to see where I'm going wrong.

grangan
Posts: 1
Joined: Wed Dec 16, 2015 12:29 pm
Delivery Date: 16 Oct 2014
Leaf Number: 6869

Re: Carwings API?

Wed Dec 16, 2015 11:32 pm

irwinr wrote:Just in case anyone else is working on this: I noticed that there is an extra HTTP Header that I didn't notice before in the initial login called "AppToken". It's a base64 encoded version of this:

Code: Select all

SmartPhoneKeyVersion=1;SmartPhoneType=ANDROID;UUID=<my Phones UUID>


So it seems this header has to be added to any requests and it treats it as the "authentication":

There is also another header called AccessKeyID:

Code: Select all

AccessKeyID:      A1r619u1ty!


BOTH of these new headers have to be present to access the new service.

-Jeremy


thanks Jeremy. For some reason the old APIs (https://nissan-na-smartphone-biz.viaaq. ... honeProxy/) still seems to be working and I just tested and most of the functionality is fine (login, request update, Start climate control). Is that expected, one of your earlier post suggested it should not be working.

Just to make sure my app is future proof I tried the new v3 api with your suggestions on AccessKeyId and AppToken in headers and I am still getting "This request requires HTTP authentication" error message. Any suggestion on how to proceed or a sample trace like IIama suggests would be helpful as well.

thanks!

BluesBro
Posts: 6
Joined: Thu Sep 17, 2015 12:58 am
Delivery Date: 12 Aug 2015

Re: Carwings API?

Thu Dec 17, 2015 12:25 am

BluesBro wrote:Hi

I'm using the https://github.com/haykinson/pycarwings script to implement controlling my Leaf in my Home automation system, byt i really need help on the AC-function.

Does anyone know how to implement AC On/Off into this script or in any script for that matter. Either as a toggle-function or 2 separate scripts, respectively on and of?

On beforehand huge thanks! :-)


I see a great deal of people here who has this API working. Is there a way to make a simple shell or python script to make a AC toggle function?

irwinr
Posts: 13
Joined: Thu Mar 26, 2015 8:20 am
Delivery Date: 26 Mar 2015

Re: Carwings API?

Sun Dec 20, 2015 3:33 pm

grangan wrote:
irwinr wrote:Just in case anyone else is working on this: I noticed that there is an extra HTTP Header that I didn't notice before in the initial login called "AppToken". It's a base64 encoded version of this:

Code: Select all

SmartPhoneKeyVersion=1;SmartPhoneType=ANDROID;UUID=<my Phones UUID>


So it seems this header has to be added to any requests and it treats it as the "authentication":

There is also another header called AccessKeyID:

Code: Select all

AccessKeyID:      A1r619u1ty!


BOTH of these new headers have to be present to access the new service.

-Jeremy


thanks Jeremy. For some reason the old APIs (https://nissan-na-smartphone-biz.viaaq. ... honeProxy/) still seems to be working and I just tested and most of the functionality is fine (login, request update, Start climate control). Is that expected, one of your earlier post suggested it should not be working.

Just to make sure my app is future proof I tried the new v3 api with your suggestions on AccessKeyId and AppToken in headers and I am still getting "This request requires HTTP authentication" error message. Any suggestion on how to proceed or a sample trace like IIama suggests would be helpful as well.

thanks!


So I don't know if the old interface is "supposed" to still be working, but it stopped for me... But I'm also a "secondary" driver on our car, my GF is the primary, so I also lost the ability to control the car online via the Nissan website.

However the new interface works fine for me now, so I don't know why I got locked out of the old one but the new one works. I can only speculate at this point.

As far as a trace, I have not performed a trace, but here's the Linux cURL command that works for me:

Code: Select all

curl -c cookies.txt -H "AccessKeyID: A1r619u1ty!" -H "AppToken: <Base 64 of token>"  -d@login.xml https://nissan-na-smartphone-biz.viaaq.com/aqPortal/v3/smartphoneProxy/userService



Where "login.xml" contains:

Code: Select all

<?xml version='1.0' encoding='utf-8' standalone='yes' ?><ns2:SmartphoneLoginWithAdditionalOperationRequest xmlns:ns2="urn:com:airbiquity:smartphone.userservices:v2" xmlns:ns3="http://www.nissanusa.com/owners/schemas/api/0" xmlns:ns4="urn:com:hitachi:gdc:type:report:v1" xmlns:ns5="urn:com:airbiquity:smartphone.reportservice:v1" xmlns:ns6="urn:com:hitachi:gdc:type:vehicle:v1" xmlns:ns7="urn:com:airbiquity:smartphone.vehicleservice:v1"><SmartphoneLoginInfo><UserLoginInfo><userId>My Email</userId><userPassword>My password</userPassword></UserLoginInfo><DeviceToken>My Token</DeviceToken><UUID>My UUID</UUID><Locale>en_US</Locale><AppVersion>3.0.2</AppVersion><SmartphoneType>ANDROID</SmartphoneType></SmartphoneLoginInfo><SmartphoneOperationType>SmartphoneGetPreferencesRequest</SmartphoneOperationType><SmartphoneOperationType>SmartphoneLatestBatteryStatusRequest</SmartphoneOperationType><SmartphoneOperationType>SmartphoneLatestACStatusRequest</SmartphoneOperationType><SmartphoneOperationType>SmartphoneGetScheduledACRemoteRequest</SmartphoneOperationType></ns2:SmartphoneLoginWithAdditionalOperationRequest>


Hopefully that helps...
-Jeremy

veezer
Posts: 17
Joined: Tue Sep 15, 2015 12:06 pm
Delivery Date: 15 Sep 2015
Leaf Number: 322523

Re: Carwings API?

Fri Jan 08, 2016 7:31 am

Anyone else *not* getting the "this request requires HTTP authentication" using the v3 URL and the curl that Jeremy shows above? I can't seem to get anything besides this error response. The old endpoint is working fine for me (for example, pycarwings works for me).

Is what I'm doing right for the various fields:

    - Random number for the DeviceToken
    - 40 char hexadecimal string for the UUID
    - base64 encoded header AppToken, with the above UUID embedded as described

flagrantfowl
Posts: 8
Joined: Mon Feb 01, 2016 8:58 pm
Delivery Date: 16 Nov 2015

Re: Carwings API?

Mon Feb 01, 2016 9:07 pm

Hi all,

I suddenly started getting HTTP 500 "Internal Server Error" responses from both my scripted Carwings API calls and from "unofficial" apps on my phone, yet the official apps and the Nissan web site seemed to be updating fine. Odd.

So, I set up a proxy to look at the traffic, and saw that the official iOS app ("NissanConnect EV") is connecting to a different URL endpoint and speaking JSON rather than XML. The new endpoint I see is: https://gdcportalgw.its-mo.com All API calls seem to be HTTP GET requests, and all parameters are on the query string.

Is anyone else familiar with this 'new' API? I see no mention of it anywhere on the web. I'm wondering if I need to try to figure it out and modify my scripts to use it rather than the old one that speaks XML.

Thanks!

Return to “Range / Efficiency / Carwings”