This JSON-based web service allows you to generate a vehicle emissions and energy economy label for use in a VEEEL-compliant window label when selling a vehicle. You will need to use this as a basis for your labelling solution in order to remain compliant with VEEEL regulation with minimal effort in future.
The web service can be used for server-side processing through a GET or POST, or in browser-based solutions through an Ajax call or similar. It returns two JPEGs (one for VEEEL, one for safety) as base64 encoded strings.
In order to use this service you first need to sign up at https://resources.fuelsaver.govt.nz
Parameters | Values | Call examples | |
---|---|---|---|
Request: | |||
api | labels | ||
plate | [a valid licence plate] - [GNJ454 | FLW415 | HOON] | ?params={"api":"labels","plate":"flw415","login":"[enter your veeel login]"} Test this call | |
vin | [a valid 17 character VIN] | ?params={"api":"labels","vin":""} | |
chassisnumber | [a valid chassis number] | ?params={"api":"labels","chassisnumber":""} | |
modelcode | [a valid NZ or Japanese model code] | ?params={"api":"labels","modelcode":"300E6H5SP25","modelvariant":"","login":"[enter your veeel login]"} Test this call | |
modelvariant | [a valid model variant number (classification number)] - required with a Japanese model code | ?params={"api":"labels","modelcode":"ABA-WF0A0D","modelvariant":"3","login":"[enter your veeel login]"} Test this call | |
login | [a valid VFEL login token obtained on signup for the VFEL service] | Get yours at: https://resources.fuelsaver.govt.nz | |
Using multiple lookup fields | plate=gnj454 will not find a vehicle because it has been de-registered | ?params={"api":"labels","plate":"gnj454","login":"[enter your veeel login]"} Test this call | |
Adding the VIN will return the vehicle label | ?params={"api":"labels","plate":"gnj454","vin":"WF0MXXGCDM6S47735" "login":"[enter your veeel login]"} Test this call | ||
(NZ) modelcode | using default list price information for Clean Car | ?params={"api":"labels","modelcode":"HA590/590AE/1","modelvariant":"","listingid":"veh_flw415","login":"[enter your veeel login]"} Test this call - use a TEST login | |
CCDpriceEligible | overriding default list price information for Clean Car CCDpriceEligible = [Yes | No | Maybe | blank] |
?params={"api":"labels","modelcode":"HA590/590AE/1","modelvariant":"","listingid":"veh_flw415","CCDpriceEligible":"Yes", "login":"[enter your veeel login]"} Test this call - use a TEST login | |
forceJSONheaders | force the API to return Content-Type application/json | ?params={"api":"labels","forceJSONheaders":"","plate":"flw415","listingid":"veh_flw415","login":"[enter your veeel login]"} Test this call | |
Sample response: | |||
{ "status":"ok", "message":"found label information", "labels":{ "vfel":"[64 bit encoded image string in JPEG format]" "safety":"[64 bit encoded image string in JPEG format]" } } |
![]() <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD..."> ![]() <img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD..."> |
Implementation steps for a browser-based solution:
$.ajax('https://fuelsaver.govt.nz/api/?params={"api":"labels","listingid":"[unique_vehicle_id]","login":"[your_veeel_login]","plate":"flw415"}',
{
type: "GET",
dataType: "json",
success: function (result) {
/*
A successful result object looks like:
{"status":"ok","details":{"Mode":"LIVE:","ErrorCode":0,"LabelFormat":"STD","LabelVersion":"2022(a)","LastRegUpdate":"2022-03-31T00:00:00","FuelType":"Petrol","Make":"MAZDA","Model":"MAZDA3", "mvrYear":"2010","LabelID":"P:FLW415D:200422","CO2stars":3,"CO2StarsText":"1.5","CleanVehicleInd":"NO REBATE","CleanVehicle":"0.00","CO2Text":"229","FuelStars":3,"FuelStarsText":"1.5","AnnFuelCostText":"3,360","FuelConsumption":"9.6", "FuelEconomyDisclaimer":"Cost per year is an estimate based on petrol price of $2.50 per litre and an average distance of 14000 km","FuelEconomyDisclaimerLong":null,"ElectricRange":null,"ElectricConsumption":null, "SafetyRatingSystem":"Used Car Safety Rating","SafetyRatingYear":"2021","SafetyStars":8,"has_details":1}, "labels":{"vfel":"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD....","safety":"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD...."}
An unsuccessfull result might look like:
{"error":"Invalid input parameters"}
or
{"ErrorCode":40,"Explanation":"No valid plate, VIN or other details specified.","LabelID":null,"LabelFormat":"NOVEH","LastRegUpdate":null,"email":"address@email.com"}
*/
if(result.ErrorCode == 0){
$('#your_data_container').html(data_from_webservice);
}else{
$('#your_data_container').html(result.Explanation);
}
},
error: function(xhr, status, the_error){
/* handle the ajax call failing e.g. server 500 errors*/
}
}
});
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState === 4){
document.getElementById('your_data_container').innerHTML = data_from_webservice;
}
};
xhr.open('GET', 'https://fuelsaver.govt.nz/api/?params={"api":"labels","listingid":"[unique_vehicle_id]","login":"[your_veeel_login]","plate":"flw415"}');
xhr.send();
var response = await fetch('https://fuelsaver.govt.nz/api/?params={"api":"labels","listingid":"[unique_vehicle_id]","login":"[your_veeel_login]","plate":"flw415"}',{
method: 'GET',
headers: {'Content-Type':'application/json'}
});
response.json();