<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>renault &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/renault/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Tue, 12 Nov 2024 08:22:14 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>renault &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Renault's Secret Mileage API]]></title>
		<link>https://shkspr.mobi/blog/2017/11/renaults-secret-mileage-api/</link>
					<comments>https://shkspr.mobi/blog/2017/11/renaults-secret-mileage-api/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 12 Nov 2017 07:35:43 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[car]]></category>
		<category><![CDATA[ev]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[NaBloPoMo]]></category>
		<category><![CDATA[renault]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=28716</guid>

					<description><![CDATA[Last year I reverse engineered Renault&#039;s Electric Car API. One of the curious omissions was mileage - it just doesn&#039;t appear there.  However! All is not lost. If you log in to your Renault Account - https://www.renault.co.uk/my-account/my-car.html - you&#039;ll get details back about your car including its make, model, date of next service, and mileage!    Why isn&#039;t this in the regular API? Who knows. …]]></description>
										<content:encoded><![CDATA[<p>Last year I <a href="https://shkspr.mobi/blog/2016/10/reverse-engineering-the-renault-zoe-api/">reverse engineered Renault's Electric Car API</a>. One of the curious omissions was mileage - it just doesn't appear there.</p>

<p>However! All is not lost. If you log in to your Renault Account - <a href="https://www.renault.co.uk/my-account/my-car.html">https://www.renault.co.uk/my-account/my-car.html</a> - you'll get details back about your car including its make, model, date of next service, <em>and mileage!</em></p>

<img src="https://shkspr.mobi/blog/wp-content/uploads/2017/10/Renaul-Mileage-fs8.png" alt="Website showing my car and its mileage" width="1024" height="576" class="aligncenter size-full wp-image-28717">

<p>Why isn't this in the regular API? Who knows. But here's how to get it programmatically.</p>

<h2 id="api"><a href="https://shkspr.mobi/blog/2017/11/renaults-secret-mileage-api/#api">API</a></h2>

<p>The API to call is:</p>

<p><code>https://www.renault.co.uk/content/renault_prod/en_GB/index/my-account/my-car/jcr:content.getvehicle.json?vin=VF1ABCDE012345678</code></p>

<p>You will need to stick your own VIN on the end.</p>

<p>That alone won't get you very far - the API requires authentication (not always a given with automotive services!) See bottom of this page for details.</p>

<h2 id="data"><a href="https://shkspr.mobi/blog/2017/11/renaults-secret-mileage-api/#data">Data</a></h2>

<p>The data you get back is fairly unexciting:</p>

<pre><code class="language-json">{
    "lastMileageRefresh": "2017-10-15",
    "mileage": 2052,
    "averageMileage": 1973,
    "lastWorkshopVisitMileage": 1853,
    "portalServices": ["ZEPORTAL", "BATTERY", "RLINK"],
    "detailedVehicleName": "Dynamique Nav",
    "registrationNumber": "PK66LTE",
    "firstRegistrationDate": "2016-08-01",
    "electric": true,
    "vehicleManual": {
        "path": "//www.cdn.renault.com/content/dam/Renault/UK/owner-services/private/zoe/X101VE/manual.pdf",
        "size": "5.46MB",
        "extension": "pdf"
    },
    "upcomingServices": [{
        "year": "2018",
        "month": "september",
        "items": [{
            "date": "2018-08-01",
            "code": "13",
            "name": "Replace the cabin filter"
        }, {
            "date": "2018-08-01",
            "code": "185",
            "name": "Z.E. A service"
        }, {
            "date": "2018-08-01",
            "code": "186",
            "name": "Z.E. B service"
        }]
    }, {
        "year": "2019",
        "month": "september",
        "items": [{
            "date": "2019-08-01",
            "code": "13",
            "name": "Replace the cabin filter"
        }, {
            "date": "2019-08-01",
            "code": "180",
            "name": "Replace 12 V battery"
        }]
    }],
    "vin": "VF1ABCDE012345678",
    "vehicleName": "ZOE",
    "smallImage": "https://3dv1.renault.com/ImageFromBookmark?configuration\u003dSKTPOU%2FSSCALL%2FPRLEX1%2FSTANDA%2FB10%2FEA2%2FDD%2FCAREG%2FVT003%2FRET02%2FRALU16%2FDRAP03%2FOV369%2FRDAR02%2FALEVA%2FSOP02C%2FTRNOR%2FLVAVIP%2FLVAREL%2FNAV3G5%2FRAD06D%2FALAR06%2FSAN913%2FBT4MR1\u0026databaseId\u003da3750aea-330d-4c06-91fd-d2ec8d82e763\u0026bookmarkSet\u003dRSITE\u0026bookmark\u003dEXT_34_AV\u0026profile\u003dHELIOS_OWNERSERVICES_SMALL_V2",
    "largeImage": "https://3dv1.renault.com/ImageFromBookmark?configuration\u003dSKTPOU%2FSSCALL%2FPRLEX1%2FSTANDA%2FB10%2FEA2%2FDD%2FCAREG%2FVT003%2FRET02%2FRALU16%2FDRAP03%2FOV369%2FRDAR02%2FALEVA%2FSOP02C%2FTRNOR%2FLVAVIP%2FLVAREL%2FNAV3G5%2FRAD06D%2FALAR06%2FSAN913%2FBT4MR1\u0026databaseId\u003da3750aea-330d-4c06-91fd-d2ec8d82e763\u0026bookmarkSet\u003dRSITE\u0026bookmark\u003dEXT_34_DESSUS\u0026profile\u003dHELIOS_OWNERSERVICES_LARGE",
    "identifier": "X101VE"
}
</code></pre>

<h2 id="authentication"><a href="https://shkspr.mobi/blog/2017/11/renaults-secret-mileage-api/#authentication">Authentication</a></h2>

<p>In order to get these data, you will need a username and password for the Renault website.  Once logged in, you should be able to inspect the requests your browser makes.  All you need is the <code>X-Mapping</code> and <code>JSESSIONID</code> part of the cookie.  You'll end up with a request like:</p>

<pre><code class="language-_">curl 'https://www.renault.co.uk/content/renault_prod/en_GB/index/my-account/my-car/jcr:content.getvehicle.json?vin=VF1ABCDE012345678' -H 'Cookie: X-Mapping-pjobmcgf=123456789; JSESSIONID=abcdefghij;
</code></pre>

<p>If you dig around the Renault site, you'll see they use Apigee and helpfully include their <code>clientKey</code> and <code>apiKey</code> in some of the JSON they send to your browser.  I'm sure people smarter than me can figure out how to use them.</p>

<h2 id="the-cake-is-a-lie"><a href="https://shkspr.mobi/blog/2017/11/renaults-secret-mileage-api/#the-cake-is-a-lie">The Cake Is A Lie</a></h2>

<p>I am not convinced that this is <em>live</em> data. It looks to me like Renault are using your average yearly mileage and extrapolating what today's mileage will be.  But it is better than nothing.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=28716&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2017/11/renaults-secret-mileage-api/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
