Carwings API?

My Nissan Leaf Forum

Help Support My Nissan Leaf Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.
24/44 kN, as in 0.56565656... kilonewtons of force. That's what my CARWINGS told me this morning was the equation it was using (when not in ECO mode and without A/C) when converting from battery capacity to range.

Why such a simple rational number??

It's really strange as I get about 4.4mi/kWh but that doesn't fit here. Yes, it's 44/10 but that's in miles and the range is in meters so the conversion factor is completely different. Plus, 24 kWh / 4.4mi/kWh / 10 may be right but you end up with 24 MWWhh/mi and those units don't even make sense!

This is 24kWh/158.4 km calculated by the car at full and when you convert to J/m you get 24Wh/158.4m -> 24*3600J/158.4m -> 24 * 36000/1584 N = 24 * (2**5 * 3**2 * 5**3)/(2**4 * 3**2 * 11) N = 24 * (2 * 5**3)/11 N = 24 * 250/11 N -> 24 * (250 * 4)/(11 * 4)/1000 kN = 24/44 kN = 6/11 kN.

I mean really? 6/11 kN? Doesn't that seem strangely coincidental as in much more rational than expected.

Can someone else with a known mi/kWh reading get their car to 100% and then read the raw Range (w/o A/C) Estimate (which should be in meters) and post it here for comparison?

Thanks.
 
Has anyone hacked the APP_TOKEN for the new V2 webservices used in the latest Android app? I keep getting a JBOSS error if I use the same techniques from pycarwings.

I am writing a new .Net driver library for LEAF Buddy, for the Windows 8 Store and an update to the Windows Phone Store.

I've found the new endpoints, and even can see that they have new features supporting 6kw charge times, and even notification preferences about the heater as (different from AC) based on a VIN check (battery heater?) It even looks like these endpoints might be global (at least they seem to support japan as well as the US).

I got everything from pycarwings working, and then some... Thank you haykinson! But, it blows up when I point to the new endpoints and change the namespaces to match. There appear to be a new native security library deriving the APP_TOKEN.
 
The new endpoints I'm talking about are:

https://nissan-na-smartphone-biz.viaaq.com/aqPortal/v3/smartphoneProxy/userService" onclick="window.open(this.href);return false;
https://nissan-na-smartphone-biz.viaaq.com/aqPortal/v2/smartphoneProxy/vehicleService" onclick="window.open(this.href);return false;

The new login would look something like this XML structure below (which is nearly identical to the v1 format), but the problem is there are also two header parameters that seem to be important.

AccessKeyID: A1r619u1ty!
AppToken: <This is calculated using a native library>

<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>xxxxx</userId>
<userPassword>xxxx</userPassword>
</UserLoginInfo>
<DeviceToken>xxxxxxx</DeviceToken>
<UUID>xxxxxx</UUID>
<Locale>US</Locale>
<AppVersion>xxxxxxx</AppVersion>
<SmartphoneType>xxxxx</SmartphoneType>
</SmartphoneLoginInfo>
<SmartphoneOperationType>SmartphoneGetPreferencesRequest</SmartphoneOperationType>
<SmartphoneOperationType>SmartphoneLatestBatteryStatusRequest</SmartphoneOperationType>
<SmartphoneOperationType>SmartphoneLatestACStatusRequest</SmartphoneOperationType>
<SmartphoneOperationType>SmartphoneGetScheduledACRemoteRequest</SmartphoneOperationType>
</ns2:SmartphoneLoginWithAdditionalOperationRequest>
 
And for the record I have sent multiple requests to Airbiquity and Nissan for developer access to their API... Silence....
 
bigtlb said:
Has anyone hacked the APP_TOKEN for the new V2 webservices used in the latest Android app?

Hmm... they may have done this specifically to prevent us from using them. If I have time I may take a look one of these days, but I wouldn't get my hopes up.
 
Nevermind. Figured it out. New Login Session looks like this...

POST /aqPortal/v3/smartphoneProxy/userService HTTP/1.1
Host: nissan-na-smartphone-biz.viaaq.com
Proxy-Connection: keep-alive
Content-Type: text/xml; charset=utf-8
Accept: */*
Accept-Language: en-us
Content-Length: 1185
AppToken: WW91IHNob3VsZCByZWFsbHkgcGljayB5b3VyIG93biBiYXNlIDY0IHRva2VuIHRvIHB1dCBoZXJlIChhbnl0aGluZyB3aWxsIHdvcmspLiAgTXlOaXNzYW5MRUFGLmNvbQ==
AccessKeyID: A1r619u1ty!
Accept-Encoding: gzip, deflate
Connection: keep-alive

<ns2:SmartphoneLoginWithAdditionalOperationRequest xmlns:ns4="urn:com:hitachi:gdc:type:report:v1" xmlns:ns7="urn:com:airbiquity:smartphone.vehicleservice:v1" xmlns:ns3="http://www.nissanusa.com/owners/schemas/api/0" xmlns:ns5="urn:com:airbiquity:smartphone.reportservice:v1" xmlns:ns2="urn:com:airbiquity:smartphone.userservices:v2" xmlns:ns6="urn:com:hitachi:gdc:type:vehicle:v1">
<SmartphoneLoginInfo>
<UserLoginInfo>
<userId>xxxxxxxx</userId>
<userPassword>yyyyyyyyyy</userPassword>
</UserLoginInfo>
<DeviceToken>DUMMY1360008051.48007703</DeviceToken>
<UUID>ffffffffffffffffffffffffffffffffffffffff</UUID>
<Locale>US</Locale>
<AppVersion>2.2.2</AppVersion>
<SmartphoneType>ANDROID</SmartphoneType>
</SmartphoneLoginInfo>
<SmartphoneOperationType>SmartphoneGetPreferencesRequest</SmartphoneOperationType>
<SmartphoneOperationType>SmartphoneLatestBatteryStatusRequest</SmartphoneOperationType>
<SmartphoneOperationType>SmartphoneLatestACStatusRequest</SmartphoneOperationType>
<SmartphoneOperationType>SmartphoneGetScheduledACRemoteRequest</SmartphoneOperationType>
</ns2:SmartphoneLoginWithAdditionalOperationRequest>


HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
X-Powered-By: Servlet 2.4; JBoss-4.3.0.GA (build: SVNTag=JBPAPP_4_3_0_GA date=200801031548)/Tomcat-5.5
Set-Cookie: JSESSIONID=1D876B6CD1CE01E58841D12077D61074; Path=/
Content-Type: text/xml, charset=UTF-8
Content-Length: 4456
Date: Mon, 04 Feb 2013 20:59:58 GMT
Set-Cookie: BIGipServernissan-na-smartphone-biz-POOL=1226114314.20480.0000; path=/

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SmartphoneLoginWithAdditionalOperationResponse xmlns:ns4="urn:com:airbiquity:smartphone.reportservice:v1" xmlns:ns7="urn:com:airbiquity:smartphone.common:v1" xmlns:ns3="urn:com:hitachi:gdc:type:report:v1" xmlns:ns5="urn:com:hitachi:gdc:type:vehicle:v1" xmlns:ns2="urn:com:airbiquity:smartphone.userservices:v2" xmlns:ns6="urn:com:airbiquity:smartphone.vehicleservice:v1">
<SmartphoneUserInfoType>
<VehicleInfo>
<Vin>zzzzzzzzzzzzzzzzzzzzzzz</Vin>
</VehicleInfo>
<Nickname>MyLeaf</Nickname>
<charger20066>false</charger20066>
<telematicsEnabled>true</telematicsEnabled>

</SmartphoneUserInfoType>
<ns4:SmartphoneLatestBatteryStatusResponse>
<SmartphoneBatteryStatusResponseType>
<ns3:BatteryStatusRecords>
<ns3:OperationResult>START</ns3:OperationResult>
<ns3:OperationDateAndTime>2013-02-04T18:51:23.0</ns3:OperationDateAndTime>
<ns3:BatteryStatus>
<ns3:BatteryChargingStatus>NOT_CHARGING</ns3:BatteryChargingStatus>
<ns3:BatteryCapacity>12</ns3:BatteryCapacity>
<ns3:BatteryRemainingAmount>12</ns3:BatteryRemainingAmount>
</ns3:BatteryStatus>
<ns3:pluginState>CONNECTED</ns3:pluginState>
<ns3:CruisingRangeAcOn>105448</ns3:CruisingRangeAcOn>
<ns3:CruisingRangeAcOff>133424</ns3:CruisingRangeAcOff>
<ns3:NotificationDateAndTime>2013-02-04T18:51:40.0</ns3:NotificationDateAndTime>
</ns3:BatteryStatusRecords>
<VehicleInfo>
<Vin>zzzzzzzzzzzzzzzzzzzzzzz</Vin>
</VehicleInfo>
<lastBatteryStatusCheckExecutionTime>2013-02-04T05:20:26.000Z</lastBatteryStatusCheckExecutionTime>
</SmartphoneBatteryStatusResponseType>
</ns4:SmartphoneLatestBatteryStatusResponse>
<ns4:SmartphoneLatestACStatusResponse>
<SmartphoneACStatusResponseType>
<ns3:RemoteACRecords>
<ns3:OperationResult>FINISH</ns3:OperationResult>
<ns3:OperationDateAndTime>2013-02-04T13:17:07.0</ns3:OperationDateAndTime>
<ns3:RemoteACOperation>START</ns3:RemoteACOperation>
<ns3:ACStartStopDateAndTime>2013-02-04T13:17:07.0</ns3:ACStartStopDateAndTime>
<ns3:CruisingRangeAcOn>90160</ns3:CruisingRangeAcOn>
<ns3:CruisingRangeAcOff>137200</ns3:CruisingRangeAcOff>
<ns3:ACStartStopURL></ns3:ACStartStopURL>
<ns3:pluginState>NOT_CONNECTED</ns3:pluginState>
<ns3:ACDurationBatterySec>900</ns3:ACDurationBatterySec>
<ns3:ACDurationPluggedSec>7200</ns3:ACDurationPluggedSec>
</ns3:RemoteACRecords>
<VehicleInfo>
<Vin>zzzzzzzzzzzzzzzzzzzzzzz</Vin>
</VehicleInfo>
</SmartphoneACStatusResponseType>
</ns4:SmartphoneLatestACStatusResponse>
<ns2:SmartphoneGetPreferencesResponse>
<NotificationPreferencesType>
<vin>zzzzzzzzzzzzzzzzzzzzzzz</vin>
<chargeStatusApple>false</chargeStatusApple>
<chargeStatusEmail>false</chargeStatusEmail>
<chargeStatusSms>false</chargeStatusSms>
<plugInReminderApple>false</plugInReminderApple>
<plugInReminderEmail>false</plugInReminderEmail>
<plugInReminderSms>true</plugInReminderSms>
<chargeCompleteApple>false</chargeCompleteApple>
<chargeCompleteEmail>false</chargeCompleteEmail>
<chargeCompleteSms>true</chargeCompleteSms>
<hvacOnApple>false</hvacOnApple>
<hvacOnEmail>false</hvacOnEmail>
<hvacOnSms>true</hvacOnSms>
<vehicleChargeApple>false</vehicleChargeApple>
<vehicleChargeEmail>false</vehicleChargeEmail>
<vehicleChargeSms>true</vehicleChargeSms>
</NotificationPreferencesType>
</ns2:SmartphoneGetPreferencesResponse>
<ns6:SmartphoneRemoteGetScheduledACResponse>
<SmartphoneRemoteGetScheduledACResponseType>
<ns5:GetScheduledACRemoteResponse/>
<VehicleInfo>
<Vin>zzzzzzzzzzzzzzzzzzzzzzz</Vin>
</VehicleInfo>
</SmartphoneRemoteGetScheduledACResponseType>
</ns6:SmartphoneRemoteGetScheduledACResponse>
</ns2:SmartphoneLoginWithAdditionalOperationResponse>
 
Computerizer said:
bigtlb said:
Nevermind. Figured it out. New Login Session looks like this...

The Secret! said:
You should really pick your own base 64 token to put here (anything will work). MyNissanLEAF.com

Nice.

Why put the same token I was planning on putting in LEAF Buddy?

After I figured out it would take anything, I figured I will have fun. :D
 
Digging through the source of the Android app, other than changing to v2 for the user service and v3 for the vehicle service, it doesn't seem to offer any new functionality other than the 66kw info.

It also appears to work without setting the app token on the request.
 
sirfergy said:
Digging through the source of the Android app, other than changing to v2 for the user service and v3 for the vehicle service, it doesn't seem to offer any new functionality other than the 66kw info.

It also appears to work without setting the app token on the request.


There is a new group of notification preferences, that are optionally turned on by VIN code logic.

There is extra information in the VehicleSelection array (which is an array to allow for multiple cars), that can include whether or not the car is still covered by Carwings subscription, and whether or not it has the 6.6KW charger.

But the more important thing is I wanted to get the new services working in case Airbiquity decided to "retire" the old endpoints.

The AccessKeyID seems to be the part I was missing last night. Then, when I saw all of the coding effort invested in creating and obfuscating the App token, I thought it actually mattered. :lol: :shock:
 
sirfergy said:
I also noticed there are no European or Australian endpoints yet.


I only saw the one set of endpoints. Did you find any others?

I noticed that the code handles Japan as well. So maybe the endpoint is global.
 
sirfergy said:
That would be nice. I guess I'll have to have a european friend test it out for me.

Please let us know if anyone can execute the login for a vehicle in a country outside of North America. Or, if anyone wants to provide an Android apk from a Google Play market outside of North America, PM me.

For those who want to try to login, but aren't sure where to start... you can execute the service using Fiddler (http://fiddlertool.com" onclick="window.open(this.href);return false;), copy the header and body into Fiddler (composer tab) and set it to POST with the userService url listed in the earlier post. Insert your user name and password into the xml in the body and execute.

You may want to turn on https decryption to see the response. Fiddler menu - Tools/Fiddler Options/HTTPS tab/check "Decrypt HTTPS traffic".
 
To save you the trouble, this is the endpoints used outside US by official apps:

Europe iphone:
https://nissan-eu-smartphone-biz.viaaq.eu" onclick="window.open(this.href);return false;
/aqPortal/smartphoneProxy/userService/ne
/aqPortal/smartphoneProxy/vehicleService

Europe android: (this is slightly different from the rest.. uses Europe/Paris timezone for all timestamps instead of Etc/UTC , responses are different, but except from charging and climate control you can use same requests as the rest)
https://mobileapps.prod.nissan.eu" onclick="window.open(this.href);return false;
/android-carwings-backend/carwingsServlet (same url for both)

Canada: (havent checked if they have gotten the new endpoints recently)
https://nissan-na-smartphone-biz.viaaq.com" onclick="window.open(this.href);return false;
/aqPortal/smartphoneProxy/userService/nci
/aqPortal/smartphoneProxy/vehicleService

Japan:
https://nissan-asia-smartphone-biz.viaaq.com" onclick="window.open(this.href);return false;
/aqPortal/smartphoneProxy/userService/nml
/aqPortal/smartphoneProxy/vehicleService
(there also seems to be a valid endpoint /aqPortal/smartphoneProxy/userService on the same server, but dont know what it is for)

Australia:
https://nissan-oc-smartphone-biz.viaaq.com" onclick="window.open(this.href);return false;
/aqPortal/smartphoneProxy/userService/nma
/aqPortal/smartphoneProxy/vehicleService


Now.. the interesting thing I just discovered is that the Japanese endpoint also allows me to log in with my European user, so it might be a global one..
(havent tested the new urls you posted from the new US app yet)

Edit: However.. after loggin in with the japanese server it seems I get 9005 error now when trying to log in to the european iphone server (guessing the session needs to time out on the japanese server before I am allowed to log in to european server again... the european android server allows logins with no problems however)
 
gyathaar,

Thank you...

So none of these have moved to v2 endpoints yet? Were these recently retrieved?

Would it be possible to show the differences in the European responses?

I am secretly hoping that with v2, Airbiquity might have consolidated everything under one global set of endpoints.
 
bigtlb said:
gyathaar,

Thank you...

So none of these have moved to v2 endpoints yet? Were these recently retrieved?

Would it be possible to show the differences in the European responses?

I am secretly hoping that with v2, Airbiquity might have consolidated everything under one global set of endpoints.

I checked the european, japanese and australian android apps yesterday.
The differences is the responses for the european android app is (in addition to different timezone for the time values):
- In several cases time values are empty instead of containing values
- Instead of having values for normal, trick and quick charge, it just has true or false
- different values indicating AC state
- Field for when data was last updated doesnt actually contain the correct time stamp for that.. instead the timestamp is in OperationDateAndTime instead of lastBatteryStatusCheckExecutionTime
- the services return a hardcoded set of result sets no matter what you specify in the SmartphoneOperationType fields
- the request for start charging needs slightly different xml to work
- start charging and start climate control requests needs to be much closer to the current time for them to start working (cant just set a time a few months in the past)
 
Rather than make apps for phones . . .
can you guys make webpages? designed for any device?

that way, I can use the same exact system from my pc or phone

before anyone says CarWings - look at how hard and slow it is to use (exact same reasons you guys found the WSDL and XML payloads)

thoughts?
 
Back
Top