Emissions Calculator PROD
API change historyRequest
Request URL
Request parameters
-
integer
IMO of a ship that will require emission calculations.
-
(optional)number
The vessels intended average sailing speed in knots on the route. Optional if durtation_h is given
-
(optional)number
Expected length of the voyage in Nautical Miles
-
(optional)string
Cargo unit used to submit cargo_amt. Currently the only possible value are tons. Used to calculate EEOI and transport_work.
-
(optional)number
Amount of cargo the ship is carrying (in given cargo_unit). Used to calculate EEOI and transport_work .
-
(optional)string
Fuel type to be considered for the main engine consumption for the emissions estimate. Overwriting the model assumption.
-
(optional)string
Secondary fuel type to be considered for the main engine consumption for the emissions estimate for parts of voyage. Overwriting the model assumption.
-
(optional)number
Specifying the ratio of voyage duration in which me_fuel_type was used. Allowed range is between 0 and 1.
-
(optional)string
Fuel type to be considered for the auxiliary engine consumption for the emissions estimate. Overwriting the model assumption.
-
(optional)string
Secondary fuel type to be considered for the auxilary engine consumption for the emissions estimate for parts of voyage. Overwriting the model assumption.
-
(optional)number
Specifying the ratio of voyage duration in which ae_fuel_type was used. Allowed range is between 0 and 1.
-
(optional)string
Fuel type to be considered for the boiler consumption for the emissions estimate. Overwriting the model assumption.
-
(optional)string
Secondary fuel type to be considered for the boiler engine consumption for the emissions estimate for parts of voyage. Overwriting the model assumption.
-
(optional)number
Specifying the ratio of voyage duration in which boiler_fuel_type was used. Allowed range is between 0 and 1.
-
(optional)number
Expected duration of the voyage in hours. Optional if avg_speed_kn is given
-
(optional)string
Loading condition of the vessel to be considered in the power estimation.
-
(optional)number
CO2 factor for main engine fuel. Main engine fuel type must be specified.
-
(optional)number
CO2 factor for auxilary engine fuel. Auxilary engine fuel type must be specified.
-
(optional)number
CO2 factor for boiler engine fuel. Boiler engine fuel type must be specified.
Request headers
Request body
Responses
200 OK
Total emissions calculation on a specified route, along with input parameters used for running the calculation.
Representations
{
"imo": 1234567,
"avg_speed_kn": 10.045,
"load_cond": "ballast",
"cargo_unit": "tons",
"cargo_amt": 544385.543,
"me_fuel_type": "MGO",
"me_fuel_type_blend": "LNG",
"me_fuel_type_ratio": 0.3,
"ae_fuel_type": "MGO",
"ae_fuel_type_blend": "HFO",
"ae_fuel_type_ratio": 0.1,
"boiler_fuel_type": "MGO",
"boiler_fuel_type_blend": null,
"boiler_fuel_type_ratio": null,
"estimated_distance_nm": "3,560.9525,",
"duration_h": 354.5,
"me_fuel_cons_metric_tons": 0.1,
"ae_fuel_cons_metric_tons": 0.1,
"boiler_fuel_cons_metric_tons": 0.1,
"total_co2_emission_metric_tons": 0.1,
"total_so2_emission_metric_tons": 0.1,
"total_pmtsp_emission_metric_tons": 0.1,
"total_pm10_emission_metric_tons": 0.1,
"total_pm2_5_emission_metric_tons": 0.1,
"total_nox_emission_metric_tons": 0.1,
"total_nmvoc_emission_metric_tons": 0.1,
"total_ch4_emission_metric_tons": 0.1,
"total_n2o_emission_metric_tons": 0.1,
"total_co_emission_metric_tons": 0.1,
"total_black_carbon_emission_metric_tons": 0.1,
"total_organic_carbon_emission_metric_tons": 0.1,
"transport_work": 0.1,
"eeoi": 0.1,
"me_co2_factor": 2.1,
"ParamValidation": {
"status": "OK"
},
"LimitMessage": {
"message_description": "You are within your call limit"
}
}
400 Bad Request
Bad request. Invalid parameters.
401 Unauthorized
Unauthorized. Bearer token and/or Subscription key is either missing, invalid or expired.
404 Not Found
Not found. Not enough information for requested vessel.
405 Method Not Allowed
Method not allowed. Unsuccessful execution.
500 Internal Server Error
Internal Server Error.
Code samples
@ECHO OFF
curl -v -X GET "https://api.veracity.com/df/ec-api/emissions-calculation?imo={imo}?avg_speed_kn={number}&distance_nm={number}&cargo_unit={string}&cargo_amt={number}&me_fuel_type={string}&me_fuel_type_blend={string}&me_fuel_type_ratio={number}&ae_fuel_type={string}&ae_fuel_type_blend={string}&ae_fuel_type_ratio={number}&boiler_fuel_type={string}&boiler_fuel_type_blend={string}&boiler_fuel_type_ratio={number}&duration_h={number}&load_cond={string}&me_co2_factor={number}&ae_co2_factor={number}&boiler_co2_factor={number}"
-H "Ocp-Apim-Subscription-Key: {subscription key}"
--data-ascii "{body}"
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;
namespace CSHttpClientSample
{
static class Program
{
static void Main()
{
MakeRequest();
Console.WriteLine("Hit ENTER to exit...");
Console.ReadLine();
}
static async void MakeRequest()
{
var client = new HttpClient();
var queryString = HttpUtility.ParseQueryString(string.Empty);
// Request headers
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");
// Request parameters
queryString["avg_speed_kn"] = "{number}";
queryString["distance_nm"] = "{number}";
queryString["cargo_unit"] = "{string}";
queryString["cargo_amt"] = "{number}";
queryString["me_fuel_type"] = "{string}";
queryString["me_fuel_type_blend"] = "{string}";
queryString["me_fuel_type_ratio"] = "{number}";
queryString["ae_fuel_type"] = "{string}";
queryString["ae_fuel_type_blend"] = "{string}";
queryString["ae_fuel_type_ratio"] = "{number}";
queryString["boiler_fuel_type"] = "{string}";
queryString["boiler_fuel_type_blend"] = "{string}";
queryString["boiler_fuel_type_ratio"] = "{number}";
queryString["duration_h"] = "{number}";
queryString["load_cond"] = "{string}";
queryString["me_co2_factor"] = "{number}";
queryString["ae_co2_factor"] = "{number}";
queryString["boiler_co2_factor"] = "{number}";
var uri = "https://api.veracity.com/df/ec-api/emissions-calculation?imo={imo}&" + queryString;
var response = await client.GetAsync(uri);
}
}
}
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
public class JavaSample
{
public static void main(String[] args)
{
HttpClient httpclient = HttpClients.createDefault();
try
{
URIBuilder builder = new URIBuilder("https://api.veracity.com/df/ec-api/emissions-calculation?imo={imo}");
builder.setParameter("avg_speed_kn", "{number}");
builder.setParameter("distance_nm", "{number}");
builder.setParameter("cargo_unit", "{string}");
builder.setParameter("cargo_amt", "{number}");
builder.setParameter("me_fuel_type", "{string}");
builder.setParameter("me_fuel_type_blend", "{string}");
builder.setParameter("me_fuel_type_ratio", "{number}");
builder.setParameter("ae_fuel_type", "{string}");
builder.setParameter("ae_fuel_type_blend", "{string}");
builder.setParameter("ae_fuel_type_ratio", "{number}");
builder.setParameter("boiler_fuel_type", "{string}");
builder.setParameter("boiler_fuel_type_blend", "{string}");
builder.setParameter("boiler_fuel_type_ratio", "{number}");
builder.setParameter("duration_h", "{number}");
builder.setParameter("load_cond", "{string}");
builder.setParameter("me_co2_factor", "{number}");
builder.setParameter("ae_co2_factor", "{number}");
builder.setParameter("boiler_co2_factor", "{number}");
URI uri = builder.build();
HttpGet request = new HttpGet(uri);
request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");
// Request body
StringEntity reqEntity = new StringEntity("{body}");
request.setEntity(reqEntity);
HttpResponse response = httpclient.execute(request);
HttpEntity entity = response.getEntity();
if (entity != null)
{
System.out.println(EntityUtils.toString(entity));
}
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
}
}
<!DOCTYPE html>
<html>
<head>
<title>JSSample</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(function() {
var params = {
// Request parameters
"avg_speed_kn": "{number}",
"distance_nm": "{number}",
"cargo_unit": "{string}",
"cargo_amt": "{number}",
"me_fuel_type": "{string}",
"me_fuel_type_blend": "{string}",
"me_fuel_type_ratio": "{number}",
"ae_fuel_type": "{string}",
"ae_fuel_type_blend": "{string}",
"ae_fuel_type_ratio": "{number}",
"boiler_fuel_type": "{string}",
"boiler_fuel_type_blend": "{string}",
"boiler_fuel_type_ratio": "{number}",
"duration_h": "{number}",
"load_cond": "{string}",
"me_co2_factor": "{number}",
"ae_co2_factor": "{number}",
"boiler_co2_factor": "{number}",
};
$.ajax({
url: "https://api.veracity.com/df/ec-api/emissions-calculation?imo={imo}&" + $.param(params),
beforeSend: function(xhrObj){
// Request headers
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
},
type: "GET",
// Request body
data: "{body}",
})
.done(function(data) {
alert("success");
})
.fail(function() {
alert("error");
});
});
</script>
</body>
</html>
#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSString* path = @"https://api.veracity.com/df/ec-api/emissions-calculation?imo={imo}";
NSArray* array = @[
// Request parameters
@"entities=true",
@"avg_speed_kn={number}",
@"distance_nm={number}",
@"cargo_unit={string}",
@"cargo_amt={number}",
@"me_fuel_type={string}",
@"me_fuel_type_blend={string}",
@"me_fuel_type_ratio={number}",
@"ae_fuel_type={string}",
@"ae_fuel_type_blend={string}",
@"ae_fuel_type_ratio={number}",
@"boiler_fuel_type={string}",
@"boiler_fuel_type_blend={string}",
@"boiler_fuel_type_ratio={number}",
@"duration_h={number}",
@"load_cond={string}",
@"me_co2_factor={number}",
@"ae_co2_factor={number}",
@"boiler_co2_factor={number}",
];
NSString* string = [array componentsJoinedByString:@"&"];
path = [path stringByAppendingFormat:@"?%@", string];
NSLog(@"%@", path);
NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
[_request setHTTPMethod:@"GET"];
// Request headers
[_request setValue:@"{subscription key}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
// Request body
[_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
NSURLResponse *response = nil;
NSError *error = nil;
NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];
if (nil != error)
{
NSLog(@"Error: %@", error);
}
else
{
NSError* error = nil;
NSMutableDictionary* json = nil;
NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
NSLog(@"%@", dataString);
if (nil != _connectionData)
{
json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
}
if (error || !json)
{
NSLog(@"Could not parse loaded json with error:%@", error);
}
NSLog(@"%@", json);
_connectionData = nil;
}
[pool drain];
return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';
$request = new Http_Request2('https://api.veracity.com/df/ec-api/emissions-calculation?imo={imo}');
$url = $request->getUrl();
$headers = array(
// Request headers
'Ocp-Apim-Subscription-Key' => '{subscription key}',
);
$request->setHeader($headers);
$parameters = array(
// Request parameters
'avg_speed_kn' => '{number}',
'distance_nm' => '{number}',
'cargo_unit' => '{string}',
'cargo_amt' => '{number}',
'me_fuel_type' => '{string}',
'me_fuel_type_blend' => '{string}',
'me_fuel_type_ratio' => '{number}',
'ae_fuel_type' => '{string}',
'ae_fuel_type_blend' => '{string}',
'ae_fuel_type_ratio' => '{number}',
'boiler_fuel_type' => '{string}',
'boiler_fuel_type_blend' => '{string}',
'boiler_fuel_type_ratio' => '{number}',
'duration_h' => '{number}',
'load_cond' => '{string}',
'me_co2_factor' => '{number}',
'ae_co2_factor' => '{number}',
'boiler_co2_factor' => '{number}',
);
$url->setQueryVariables($parameters);
$request->setMethod(HTTP_Request2::METHOD_GET);
// Request body
$request->setBody("{body}");
try
{
$response = $request->send();
echo $response->getBody();
}
catch (HttpException $ex)
{
echo $ex;
}
?>
########### Python 2.7 #############
import httplib, urllib, base64
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.urlencode({
# Request parameters
'avg_speed_kn': '{number}',
'distance_nm': '{number}',
'cargo_unit': '{string}',
'cargo_amt': '{number}',
'me_fuel_type': '{string}',
'me_fuel_type_blend': '{string}',
'me_fuel_type_ratio': '{number}',
'ae_fuel_type': '{string}',
'ae_fuel_type_blend': '{string}',
'ae_fuel_type_ratio': '{number}',
'boiler_fuel_type': '{string}',
'boiler_fuel_type_blend': '{string}',
'boiler_fuel_type_ratio': '{number}',
'duration_h': '{number}',
'load_cond': '{string}',
'me_co2_factor': '{number}',
'ae_co2_factor': '{number}',
'boiler_co2_factor': '{number}',
})
try:
conn = httplib.HTTPSConnection('api.veracity.com')
conn.request("GET", "/df/ec-api/emissions-calculation?imo={imo}&%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.parse.urlencode({
# Request parameters
'avg_speed_kn': '{number}',
'distance_nm': '{number}',
'cargo_unit': '{string}',
'cargo_amt': '{number}',
'me_fuel_type': '{string}',
'me_fuel_type_blend': '{string}',
'me_fuel_type_ratio': '{number}',
'ae_fuel_type': '{string}',
'ae_fuel_type_blend': '{string}',
'ae_fuel_type_ratio': '{number}',
'boiler_fuel_type': '{string}',
'boiler_fuel_type_blend': '{string}',
'boiler_fuel_type_ratio': '{number}',
'duration_h': '{number}',
'load_cond': '{string}',
'me_co2_factor': '{number}',
'ae_co2_factor': '{number}',
'boiler_co2_factor': '{number}',
})
try:
conn = http.client.HTTPSConnection('api.veracity.com')
conn.request("GET", "/df/ec-api/emissions-calculation?imo={imo}&%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
require 'net/http'
uri = URI('https://api.veracity.com/df/ec-api/emissions-calculation?imo={imo}')
query = URI.encode_www_form({
# Request parameters
'avg_speed_kn' => '{number}',
'distance_nm' => '{number}',
'cargo_unit' => '{string}',
'cargo_amt' => '{number}',
'me_fuel_type' => '{string}',
'me_fuel_type_blend' => '{string}',
'me_fuel_type_ratio' => '{number}',
'ae_fuel_type' => '{string}',
'ae_fuel_type_blend' => '{string}',
'ae_fuel_type_ratio' => '{number}',
'boiler_fuel_type' => '{string}',
'boiler_fuel_type_blend' => '{string}',
'boiler_fuel_type_ratio' => '{number}',
'duration_h' => '{number}',
'load_cond' => '{string}',
'me_co2_factor' => '{number}',
'ae_co2_factor' => '{number}',
'boiler_co2_factor' => '{number}'
})
if query.length > 0
if uri.query && uri.query.length > 0
uri.query += '&' + query
else
uri.query = query
end
end
request = Net::HTTP::Get.new(uri.request_uri)
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request body
request.body = "{body}"
response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
http.request(request)
end
puts response.body