Agri Api Documentation v0.9.1
Compilation Date: Sat, 18 Apr 2020 23:38:21 GMT
This is the documentation for the {product} API at https://api.vantage.informaecon.com
{product} Host = api.vantage.informaecon.com
Email: {product} Support
Authentication
Authentication is provided by Basic authentication using the Username and Password you were given by the {product} Customer Success team.
If you have access to the API, then all of your subscribed channels will be available if they serve data.
Basic authentication is defined in RFC 2617, HTTP Authentication Basic and Digest Access Authentication
Guidelines for using this API
The API is using live data fed from the {product} AGRI data backend, a portion of the data is classified as restricted
. When you come upon restricted data, you will either receive an empty array []
or a notification in the format of {timeSeriesId, Message}
where the message would read something like Sorry but this data is restricted.
Best results from a browser
For easy navigation and operation from a browser, we recommend using Google Chrome.
The easiest way to utilize this API is to browse the data from the comfort of your browser, when you find the data you want, you may copy the
url
link to your chosen consuming application.
Within Chrome, you should install one of the Chrome extensions from the Chrome Web Shop (free). The best tried and tested extension is Json Viewer
.
This viewer will pretty format the data and allow you to click through the url
links presented at every level of data diving the API.
Check out "JSON Viewer": By following this link to chrome webstore
Without Json Viewer
{"id":"fert-european","commodities":[{"id":"France","url":"https://api.agribusiness.ihsmarkit.com/commodities/Fertecon/fert-european/RnJhbmNl","name":"France"},{"id":"United Kingdom","url":"https://api.agribusiness.ihsmarkit.com/commodities/Fertecon/fert-european/VW5pdGVkIEtpbmdkb20","name":"United Kingdom"}]}
Use in your own systems
Code snippets appear in this column.
Along the top of this panel are language selectors, clicking each of these will show the relevant code example to consume the data at each API level.
Along with the descriptions for each API Path - there are a number of language specific code examples for basic implementation. Each code snippet works in it's respective language and is to be referred to as an example of how to retrieve the data.
This gives you the power to chose how to consume the data by example.
API Paths
Your Products (Root)
Code Example
<script>
var username = 'username';
var password = 'password';
var auth = 'Basic ' + btoa(username + ':' + password);
$.ajax({
url: 'https://api.vantage.informaecon.com',
method: 'get',
crossDomain: true,
headers: {'Authorization' : auth},
success: function(data) {
console.log(JSON.stringify(data));
}
})
</script>
GET https://api.vantage.informaecon.com HTTP/1.1
Host: api.vantage.informaecon.com
Content-Type: application/json
Authorization: Basic [base64Hash]
Accept: application/json
const request = require('request');
var username = 'username';
var password = 'password';
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
request({
uri: 'https://api.vantage.informaecon.com',
method: 'GET',
headers: {'Authorization' : auth}
},function(error, response, body) {
console.log(body);
});
import urllib2, base64
username = "username"
password="password"
request = urllib2.Request("https://api.vantage.informaecon.com")
base64string = base64.b64encode("%s:%s" % (username, password))
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
print result
require 'net/http'
require 'net/https'
require 'uri'
api_username= 'username'
api_password= 'password'
url = URI.parse("https://odata.qa1.agri.informa-labs.com/")
req = Net::HTTP::Get.new(url.path)
req.basic_auth api_username, api_password
sock = Net::HTTP.new(url.host, url.port)
sock.use_ssl = true
res = sock.start {|http| http.request(req) }
print res.body
# you can also use wget
curl --user username:password https://api.vantage.informaecon.com
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
{
class program
{
static void Main()
{
Task t = new Task(HTTP_GET);
t.Start();
Console.ReadLine();
}
static async void HTTP_GET()
{
var TARGETURL = "https://api.vantage.informaecon.com";
HttpClientHandler handler = new HttpClientHandler()
{
Proxy = new WebProxy("http://127.0.0.1:8888"),
UseProxy = true,
};
Console.WriteLine("GET: + " + TARGETURL);
// ... Use HttpClient.
HttpClient client = new HttpClient(handler);
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
HttpResponseMessage response = await client.GetAsync(TARGETURL);
HttpContent content = response.Content;
// ... Check Status Code
Console.WriteLine("Response StatusCode: " + (int)response.StatusCode);
// ... Read the string.
string result = await content.ReadAsStringAsync();
// ... Display the result.
if (result != null && result.Length >= 50)
{
Console.WriteLine(result.Substring(0, 50) + "...");
}
}
}
}
Example Return
This returns some useful information and a products
object with an array of id
, name
and url
.
The url
value is always a direct link to the resource (id).
{
"documentation": "https://developer.agribusiness.ihsmarkit.com",
"version": "1.0.1.220",
"message": "API data is live. For best usage, refer to the documentation link.",
"logoutUrl": "https://api.vantage.informaecon.com/logout",
"user": "a.user@anotherdomain.com",
"products": [
{
"id": "vantage",
"name": "Vantage",
"url": "https://api.vantage.informaecon.com/products/Vantage"
}
]
}
Root
name | type | value |
---|---|---|
documentation | url | link to the documentation you're reading now |
version | string | Build version |
message | string | Api MOTD |
logoutUrl | string | A convenience url to enable you to log out of the system |
user | string | The currently logged in userName |
products | array of product | your entitled product list (see below) |
Product Values
name | type | value |
---|---|---|
id | string | Product Id |
name | string | Product friendly name |
url | string | Url path to the Product |
For additional Product subscriptions - contact your IHS Markit representative.
Product Channels
Code Example
<script>
var username = 'username';
var password = 'password';
var auth = 'Basic ' + btoa(username + ':' + password);
$.ajax({
url: 'https://api.vantage.informaecon.com/products/Vantage',
method: 'get',
crossDomain: true,
headers: {'Authorization' : auth},
success: function(data) {
console.log(JSON.stringify(data));
}
})
</script>
GET https://api.vantage.informaecon.com/products/Vantage HTTP/1.1
Host: api.vantage.informaecon.com
Content-Type: application/json
Authorization: Basic [base64Hash]
Accept: application/json
const request = require('request');
var username = 'username';
var password = 'password';
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
request({
uri: 'https://api.vantage.informaecon.com/products/Vantage',
method: 'GET',
headers: {'Authorization' : auth}
},function(error, response, body) {
console.log(body);
});
import urllib2, base64
username = "username"
password="password"
request = urllib2.Request("https://api.vantage.informaecon.com/products/Vantage")
base64string = base64.b64encode("%s:%s" % (username, password))
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
print result
require 'net/http'
require 'net/https'
require 'uri'
api_username= 'username'
api_password= 'password'
url = URI.parse("https://odata.qa1.agri.informa-labs.com/")
req = Net::HTTP::Get.new(url.path)
req.basic_auth api_username, api_password
sock = Net::HTTP.new(url.host, url.port)
sock.use_ssl = true
res = sock.start {|http| http.request(req) }
print res.body
# you can also use wget
curl --user username:password https://api.vantage.informaecon.com/products/Vantage
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
{
class program
{
static void Main()
{
Task t = new Task(HTTP_GET);
t.Start();
Console.ReadLine();
}
static async void HTTP_GET()
{
var TARGETURL = "https://api.vantage.informaecon.com/products/Vantage";
HttpClientHandler handler = new HttpClientHandler()
{
Proxy = new WebProxy("http://127.0.0.1:8888"),
UseProxy = true,
};
Console.WriteLine("GET: + " + TARGETURL);
// ... Use HttpClient.
HttpClient client = new HttpClient(handler);
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
HttpResponseMessage response = await client.GetAsync(TARGETURL);
HttpContent content = response.Content;
// ... Check Status Code
Console.WriteLine("Response StatusCode: " + (int)response.StatusCode);
// ... Read the string.
string result = await content.ReadAsStringAsync();
// ... Display the result.
if (result != null && result.Length >= 50)
{
Console.WriteLine(result.Substring(0, 50) + "...");
}
}
}
}
Example Return
This returns a channels
object with an array of id
, name
and url
.
The url
value is a direct link to the resource (id).
{
"channels": [
{
"id": "ayp",
"name": "Acreage & Production",
"url": "https://api.vantage.informaecon.com/channels/Vantage/ayp"
},
{
"id": "beef",
"name": "beef",
"url": "https://api.vantage.informaecon.com/channels/Vantage/beef"
},
{
"id": "cotton",
"name": "cotton",
"url": "https://api.vantage.informaecon.com/channels/Vantage/cotton"
},
{
"id": "dairy",
"name": "dairy",
"url": "https://api.vantage.informaecon.com/channels/Vantage/dairy"
}]
}
Channel Values
name | type | value |
---|---|---|
id | string | Channel Id |
name | string | Channel friendly name |
url | string | Url path to the Channel |
For additional Channel subscriptions - contact your IHS Markit representative.
Channel
Code Example
<script>
var username = 'username';
var password = 'password';
var auth = 'Basic ' + btoa(username + ':' + password);
$.ajax({
url: 'https://api.vantage.informaecon.com/channels/ayp',
method: 'get',
crossDomain: true,
headers: {'Authorization' : auth},
success: function(data) {
console.log(JSON.stringify(data));
}
})
</script>
GET https://api.vantage.informaecon.com/channels/ayp HTTP/1.1
Host: api.vantage.informaecon.com
Content-Type: application/json
Authorization: Basic [base64Hash]
Accept: application/json
const request = require('request');
var username = 'username';
var password = 'password';
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
request({
uri: 'https://api.vantage.informaecon.com/channels/ayp',
method: 'GET',
headers: {'Authorization' : auth}
},function(error, response, body) {
console.log(body);
});
import urllib2, base64
username = "username"
password="password"
request = urllib2.Request("https://api.vantage.informaecon.com/channels/ayp")
base64string = base64.b64encode("%s:%s" % (username, password))
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
print result
require 'net/http'
require 'net/https'
require 'uri'
api_username= 'username'
api_password= 'password'
url = URI.parse("https://odata.qa1.agri.informa-labs.com/")
req = Net::HTTP::Get.new(url.path)
req.basic_auth api_username, api_password
sock = Net::HTTP.new(url.host, url.port)
sock.use_ssl = true
res = sock.start {|http| http.request(req) }
print res.body
# you can also use wget
curl --user username:password https://api.vantage.informaecon.com/channels/ayp
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
{
class program
{
static void Main()
{
Task t = new Task(HTTP_GET);
t.Start();
Console.ReadLine();
}
static async void HTTP_GET()
{
var TARGETURL = "https://api.vantage.informaecon.com/channels/ayp";
HttpClientHandler handler = new HttpClientHandler()
{
Proxy = new WebProxy("http://127.0.0.1:8888"),
UseProxy = true,
};
Console.WriteLine("GET: + " + TARGETURL);
// ... Use HttpClient.
HttpClient client = new HttpClient(handler);
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
HttpResponseMessage response = await client.GetAsync(TARGETURL);
HttpContent content = response.Content;
// ... Check Status Code
Console.WriteLine("Response StatusCode: " + (int)response.StatusCode);
// ... Read the string.
string result = await content.ReadAsStringAsync();
// ... Display the result.
if (result != null && result.Length >= 50)
{
Console.WriteLine(result.Substring(0, 50) + "...");
}
}
}
}
Example Return
This returns a single channel
object with it's id
, a list of commodities
in that channel
and a list of regions
for that channel
.
The url
values are a direct link to the relative resources.
{
"id": "ayp",
"commodities": [
{
"id": "barley",
"url": "https://api.vantage.informaecon.com/ayp/commodities/barley",
"name": "Barley"
}
],
"regions": [
{
"id": "usa-ar",
"country": "United States",
"locality": "Arkansas",
"url": "https://api.vantage.informaecon.com/ayp/:regionIds/usa-ar"
}
]
}
Get all Commodities and Regions for this Channel
Commodities
name | type | value |
---|---|---|
id | string | Commodity Id |
url | string | URL |
name | string | Friendly name |
Regions
name | type | description |
---|---|---|
id | string | region Id |
country | string | Country Name |
region | string? | Locality/Region |
url | string | Region Url |
timeSeriesUrl | string | Time series data Url |
Commodity
Code Example
<script>
var username = 'username';
var password = 'password';
var auth = 'Basic ' + btoa(username + ':' + password);
$.ajax({
url: 'https://api.vantage.informaecon.com/commodities/ayp/barley',
method: 'get',
crossDomain: true,
headers: {'Authorization' : auth},
success: function(data) {
console.log(JSON.stringify(data));
}
})
</script>
GET https://api.vantage.informaecon.com/commodities/ayp/barley HTTP/1.1
Host: api.vantage.informaecon.com
Content-Type: application/json
Authorization: Basic [base64Hash]
Accept: application/json
const request = require('request');
var username = 'username';
var password = 'password';
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
request({
uri: 'https://api.vantage.informaecon.com/commodities/ayp/barley',
method: 'GET',
headers: {'Authorization' : auth}
},function(error, response, body) {
console.log(body);
});
import urllib2, base64
username = "username"
password="password"
request = urllib2.Request("https://api.vantage.informaecon.com/commodities/ayp/barley")
base64string = base64.b64encode("%s:%s" % (username, password))
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
print result
require 'net/http'
require 'net/https'
require 'uri'
api_username= 'username'
api_password= 'password'
url = URI.parse("https://odata.qa1.agri.informa-labs.com/")
req = Net::HTTP::Get.new(url.path)
req.basic_auth api_username, api_password
sock = Net::HTTP.new(url.host, url.port)
sock.use_ssl = true
res = sock.start {|http| http.request(req) }
print res.body
# you can also use wget
curl --user username:password https://api.vantage.informaecon.com/commodities/ayp/barley
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
{
class program
{
static void Main()
{
Task t = new Task(HTTP_GET);
t.Start();
Console.ReadLine();
}
static async void HTTP_GET()
{
var TARGETURL = "https://api.vantage.informaecon.com/commodities/ayp/barley";
HttpClientHandler handler = new HttpClientHandler()
{
Proxy = new WebProxy("http://127.0.0.1:8888"),
UseProxy = true,
};
Console.WriteLine("GET: + " + TARGETURL);
// ... Use HttpClient.
HttpClient client = new HttpClient(handler);
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
HttpResponseMessage response = await client.GetAsync(TARGETURL);
HttpContent content = response.Content;
// ... Check Status Code
Console.WriteLine("Response StatusCode: " + (int)response.StatusCode);
// ... Read the string.
string result = await content.ReadAsStringAsync();
// ... Display the result.
if (result != null && result.Length >= 50)
{
Console.WriteLine(result.Substring(0, 50) + "...");
}
}
}
}
This returns a commodity
object with an array of regions
.
Example Return
{
"id": "barley",
"channelId": "ayp",
"channelUrl": "https://api.vantage.informaecon.com/ayp",
"name": "Barley",
"regions": [
{
"id": "usa-co",
"country": "United States of America",
"locality": "Colorado",
"url": "https://api.vantage.informaecon.com/regions/ayp/usa-co",
"timeSeriesUrl": "https://api.vantage.informaecon.com/timeseries/ayp/barley/usa-co"
},
{
"id": "usa-az",
"country": "United States of America",
"locality": "Arizona",
"url": "https://api.vantage.informaecon.com/regions/ayp/usa-az",
"timeSeriesUrl": "https://api.vantage.informaecon.com/timeseries/ayp/barley/usa-az"
}
]
}
Commodity
name | type | description |
---|---|---|
id | string | Commodity name |
channelId | string | Channel Id |
channelUrl | string | Url |
name | string | Friendly Name |
regions | object | List of Regions |
Regions
name | type | description |
---|---|---|
id | string | region Id |
country | string | Country Name |
region | string? | Locality/Region |
url | string | Region Url |
timeSeriesUrl | string | Time series data Url |
Region
Code Example
<script>
var username = 'username';
var password = 'password';
var auth = 'Basic ' + btoa(username + ':' + password);
$.ajax({
url: 'https://api.vantage.informaecon.com/regions/ayp/usa-co',
method: 'get',
crossDomain: true,
headers: {'Authorization' : auth},
success: function(data) {
console.log(JSON.stringify(data));
}
})
</script>
GET https://api.vantage.informaecon.com/regions/ayp/usa-co HTTP/1.1
Host: api.vantage.informaecon.com
Content-Type: application/json
Authorization: Basic [base64Hash]
Accept: application/json
const request = require('request');
var username = 'username';
var password = 'password';
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
request({
uri: 'https://api.vantage.informaecon.com/regions/ayp/usa-co',
method: 'GET',
headers: {'Authorization' : auth}
},function(error, response, body) {
console.log(body);
});
import urllib2, base64
username = "username"
password="password"
request = urllib2.Request("https://api.vantage.informaecon.com/regions/ayp/usa-co")
base64string = base64.b64encode("%s:%s" % (username, password))
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
print result
require 'net/http'
require 'net/https'
require 'uri'
api_username= 'username'
api_password= 'password'
url = URI.parse("https://odata.qa1.agri.informa-labs.com/")
req = Net::HTTP::Get.new(url.path)
req.basic_auth api_username, api_password
sock = Net::HTTP.new(url.host, url.port)
sock.use_ssl = true
res = sock.start {|http| http.request(req) }
print res.body
# you can also use wget
curl --user username:password https://api.vantage.informaecon.com/regions/ayp/usa-co
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
{
class program
{
static void Main()
{
Task t = new Task(HTTP_GET);
t.Start();
Console.ReadLine();
}
static async void HTTP_GET()
{
var TARGETURL = "https://api.vantage.informaecon.com/regions/ayp/usa-co";
HttpClientHandler handler = new HttpClientHandler()
{
Proxy = new WebProxy("http://127.0.0.1:8888"),
UseProxy = true,
};
Console.WriteLine("GET: + " + TARGETURL);
// ... Use HttpClient.
HttpClient client = new HttpClient(handler);
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
HttpResponseMessage response = await client.GetAsync(TARGETURL);
HttpContent content = response.Content;
// ... Check Status Code
Console.WriteLine("Response StatusCode: " + (int)response.StatusCode);
// ... Read the string.
string result = await content.ReadAsStringAsync();
// ... Display the result.
if (result != null && result.Length >= 50)
{
Console.WriteLine(result.Substring(0, 50) + "...");
}
}
}
}
This returns a region
object with an array of commodities
.
Example return
{
"id": "usa-co",
"country": "United States of America",
"region": "Colorado",
"channelId": "ayp",
"channelUrl": "https://api.vantage.informaecon.com/channels/ayp",
"commodities": [
{
"id": "all-cotton",
"url": "https://api.vantage.informaecon.com/commodities/ayp/all-cotton",
"name": "All Cotton",
"timeSeriesUrl": "https://api.vantage.informaecon.com/timeseries/ayp/all-cotton/usa-co"
}
]
}
Region
name | type | value |
---|---|---|
id | string | region Id |
country | string | Country name |
region | string? | Region/locality name |
channelId | string | channel Id |
channelUrl | string | channel Url |
commodities | object | List of commodities in this region and channel |
Commodities
name | type | description |
---|---|---|
id | string | Commodity id |
url | string | Url |
name | string | Friendly Name |
timeSeriesUrl | string | timeSeries Url |
Commodity Region
Code Example
<script>
var username = 'username';
var password = 'password';
var auth = 'Basic ' + btoa(username + ':' + password);
$.ajax({
url: 'https://api.vantage.informaecon.com/timeseries/ayp/barley/usa-co',
method: 'get',
crossDomain: true,
headers: {'Authorization' : auth},
success: function(data) {
console.log(JSON.stringify(data));
}
})
</script>
GET https://api.vantage.informaecon.com/timeseries/ayp/barley/usa-co HTTP/1.1
Host: api.vantage.informaecon.com
Content-Type: application/json
Authorization: Basic [base64Hash]
Accept: application/json
const request = require('request');
var username = 'username';
var password = 'password';
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
request({
uri: 'https://api.vantage.informaecon.com/timeseries/ayp/barley/usa-co',
method: 'GET',
headers: {'Authorization' : auth}
},function(error, response, body) {
console.log(body);
});
import urllib2, base64
username = "username"
password="password"
request = urllib2.Request("https://api.vantage.informaecon.com/timeseries/ayp/barley/usa-co")
base64string = base64.b64encode("%s:%s" % (username, password))
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
print result
require 'net/http'
require 'net/https'
require 'uri'
api_username= 'username'
api_password= 'password'
url = URI.parse("https://odata.qa1.agri.informa-labs.com/")
req = Net::HTTP::Get.new(url.path)
req.basic_auth api_username, api_password
sock = Net::HTTP.new(url.host, url.port)
sock.use_ssl = true
res = sock.start {|http| http.request(req) }
print res.body
# you can also use wget
curl --user username:password https://api.vantage.informaecon.com/timeseries/ayp/barley/usa-co
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
{
class program
{
static void Main()
{
Task t = new Task(HTTP_GET);
t.Start();
Console.ReadLine();
}
static async void HTTP_GET()
{
var TARGETURL = "https://api.vantage.informaecon.com/timeseries/ayp/barley/usa-co";
HttpClientHandler handler = new HttpClientHandler()
{
Proxy = new WebProxy("http://127.0.0.1:8888"),
UseProxy = true,
};
Console.WriteLine("GET: + " + TARGETURL);
// ... Use HttpClient.
HttpClient client = new HttpClient(handler);
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
HttpResponseMessage response = await client.GetAsync(TARGETURL);
HttpContent content = response.Content;
// ... Check Status Code
Console.WriteLine("Response StatusCode: " + (int)response.StatusCode);
// ... Read the string.
string result = await content.ReadAsStringAsync();
// ... Display the result.
if (result != null && result.Length >= 50)
{
Console.WriteLine(result.Substring(0, 50) + "...");
}
}
}
}
This returns a list of metric
objects for this commodity
and region
.
Example return
[
{
"id": "harvested-acreage",
"url": "https://api.vantage.informaecon.com/timeseries/ayp/barley/usa-co/harvested-acreage",
"name": "Harvested Acreage"
}
]
TimeSeries
name | type | value |
---|---|---|
id | string | timeSeries id |
url | string | Url |
name | string | Friendly Name |
Time Series
Code Example
<script>
var username = 'username';
var password = 'password';
var auth = 'Basic ' + btoa(username + ':' + password);
$.ajax({
url: 'https://api.vantage.informaecon.com/timeseries/channelId/commodityId/regionId/metricId',
method: 'get',
crossDomain: true,
headers: {'Authorization' : auth},
success: function(data) {
console.log(JSON.stringify(data));
}
})
</script>
GET https://api.vantage.informaecon.com/timeseries/channelId/commodityId/regionId/metricId HTTP/1.1
Host: api.vantage.informaecon.com
Content-Type: application/json
Authorization: Basic [base64Hash]
Accept: application/json
const request = require('request');
var username = 'username';
var password = 'password';
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
request({
uri: 'https://api.vantage.informaecon.com/timeseries/channelId/commodityId/regionId/metricId',
method: 'GET',
headers: {'Authorization' : auth}
},function(error, response, body) {
console.log(body);
});
import urllib2, base64
username = "username"
password="password"
request = urllib2.Request("https://api.vantage.informaecon.com/timeseries/channelId/commodityId/regionId/metricId")
base64string = base64.b64encode("%s:%s" % (username, password))
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
print result
require 'net/http'
require 'net/https'
require 'uri'
api_username= 'username'
api_password= 'password'
url = URI.parse("https://odata.qa1.agri.informa-labs.com/")
req = Net::HTTP::Get.new(url.path)
req.basic_auth api_username, api_password
sock = Net::HTTP.new(url.host, url.port)
sock.use_ssl = true
res = sock.start {|http| http.request(req) }
print res.body
# you can also use wget
curl --user username:password https://api.vantage.informaecon.com/timeseries/channelId/commodityId/regionId/metricId
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
{
class program
{
static void Main()
{
Task t = new Task(HTTP_GET);
t.Start();
Console.ReadLine();
}
static async void HTTP_GET()
{
var TARGETURL = "https://api.vantage.informaecon.com/timeseries/channelId/commodityId/regionId/metricId";
HttpClientHandler handler = new HttpClientHandler()
{
Proxy = new WebProxy("http://127.0.0.1:8888"),
UseProxy = true,
};
Console.WriteLine("GET: + " + TARGETURL);
// ... Use HttpClient.
HttpClient client = new HttpClient(handler);
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
HttpResponseMessage response = await client.GetAsync(TARGETURL);
HttpContent content = response.Content;
// ... Check Status Code
Console.WriteLine("Response StatusCode: " + (int)response.StatusCode);
// ... Read the string.
string result = await content.ReadAsStringAsync();
// ... Display the result.
if (result != null && result.Length >= 50)
{
Console.WriteLine(result.Substring(0, 50) + "...");
}
}
}
}
This returns a timeseries
object for the chosen metric
.
Example return
{
"timeSeriesId": "Sugar.Raw_Sugar.Price.US.No__11.front_month",
"channel": "Sugar",
"channelId": "sugar",
"channelUrl": "https://api.vantage.informaecon.com/channels/Vantage/sugar",
"commodity": "Raw Sugar",
"commodityId": "Raw Sugar",
"commodityUrl": "https://api.vantage.informaecon.com/commodities/Vantage/sugar/UmF3IFN1Z2Fy",
"regionId": "US",
"country": "US",
"locality": "US",
"regionUrl": "https://api.vantage.informaecon.com/regions/Vantage/sugar/VVM",
"metric": "No 11",
"unit": "USC per lb",
"frequency": "Daily",
"dataPointsUrl": "https://api.vantage.informaecon.com/timeseries/Vantage/sugar/U3VnYXIuUmF3X1N1Z2FyLlByaWNlLlVTLk5vX18xMS5mcm9udF9tb250aA",
"metricId": "No 11",
"dataPointsCount": 2869,
"customProperties": null
}
Retrieve a list of data points.
Time Series summaries
name | type | value |
---|---|---|
timeSeriesId | string | This dataset identifier |
channel | string | Channel name |
channelId | string | Channel Id |
channelUrl | string | Channel Url |
commodity | string | Commodity Name |
commodityId | string | Commodity Id |
commodityUrl | string | Commodity Url |
regionId | string | Region Id |
country | string | Country friendly name |
locality | string | Locality/Region name |
regionUrl | string | Region Url |
metric | string | Metric name |
unit | string | Unit of measurement |
frequency | string | Data frequency |
dataPointsUrl | string | Url to the datapoints |
metricId | string | Metric Id |
dataPointsCount | int | count of datapoints |
customProperties | array | a collection of custom properties for this time series or null |
Time Series
name | type | value |
---|---|---|
id | string | Identity |
timeSeriesId | string | This dataset identifier |
actualDataPointsUrl | string | Link to retrieve just the dataPoints |
channel | string | Channel name |
commodity | string | Commodity name |
country | string | Country name |
metric | string | Metric name |
unit | String | Unit of measurement |
frequency | int | number |
customProperties | array | collection of attributes for this dataset |
filterableAttributes | array | A descriptive list of attributes that may be filtered on, see the section on Filtering Data below. |
dataPoints
name | type | value |
---|---|---|
date | string | date |
value | number | value |
type | string | Actual/Projected |
updatedAtUtc | string | Utc date value for when the point was updated |
annotation | string | if an analyst commented on a data value, it will appear in here |
DataPoints
Code Example
<script>
var username = 'username';
var password = 'password';
var auth = 'Basic ' + btoa(username + ':' + password);
$.ajax({
url: 'https://api.vantage.informaecon.com/datapoints/channel/commodity/timeSeriesId',
method: 'get',
crossDomain: true,
headers: {'Authorization' : auth},
success: function(data) {
console.log(JSON.stringify(data));
}
})
</script>
GET https://api.vantage.informaecon.com/datapoints/channel/commodity/timeSeriesId HTTP/1.1
Host: api.vantage.informaecon.com
Content-Type: application/json
Authorization: Basic [base64Hash]
Accept: application/json
const request = require('request');
var username = 'username';
var password = 'password';
var auth = 'Basic ' + new Buffer(username + ':' + password).toString('base64');
request({
uri: 'https://api.vantage.informaecon.com/datapoints/channel/commodity/timeSeriesId',
method: 'GET',
headers: {'Authorization' : auth}
},function(error, response, body) {
console.log(body);
});
import urllib2, base64
username = "username"
password="password"
request = urllib2.Request("https://api.vantage.informaecon.com/datapoints/channel/commodity/timeSeriesId")
base64string = base64.b64encode("%s:%s" % (username, password))
request.add_header("Authorization", "Basic %s" % base64string)
result = urllib2.urlopen(request)
print result
require 'net/http'
require 'net/https'
require 'uri'
api_username= 'username'
api_password= 'password'
url = URI.parse("https://odata.qa1.agri.informa-labs.com/")
req = Net::HTTP::Get.new(url.path)
req.basic_auth api_username, api_password
sock = Net::HTTP.new(url.host, url.port)
sock.use_ssl = true
res = sock.start {|http| http.request(req) }
print res.body
# you can also use wget
curl --user username:password https://api.vantage.informaecon.com/datapoints/channel/commodity/timeSeriesId
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;
using System.Net;
namespace HTTP_Test
{
class program
{
static void Main()
{
Task t = new Task(HTTP_GET);
t.Start();
Console.ReadLine();
}
static async void HTTP_GET()
{
var TARGETURL = "https://api.vantage.informaecon.com/datapoints/channel/commodity/timeSeriesId";
HttpClientHandler handler = new HttpClientHandler()
{
Proxy = new WebProxy("http://127.0.0.1:8888"),
UseProxy = true,
};
Console.WriteLine("GET: + " + TARGETURL);
// ... Use HttpClient.
HttpClient client = new HttpClient(handler);
var byteArray = Encoding.ASCII.GetBytes("username:password");
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
HttpResponseMessage response = await client.GetAsync(TARGETURL);
HttpContent content = response.Content;
// ... Check Status Code
Console.WriteLine("Response StatusCode: " + (int)response.StatusCode);
// ... Read the string.
string result = await content.ReadAsStringAsync();
// ... Display the result.
if (result != null && result.Length >= 50)
{
Console.WriteLine(result.Substring(0, 50) + "...");
}
}
}
}
This returns a list of dataPoints
objects for the selected timeSeries
.
Example Return
[
{
"date": "2016-06-01T00:00:00Z",
"value": 74.0,
"type": "Actual",
"updatedAtUtc": "2016-12-02T16:32:47.834893Z",
"annotation": "A comment in here"
},
{
"date": "2015-06-01T00:00:00Z",
"value": 63.0,
"type": "Actual",
"updatedAtUtc": "2016-12-02T16:32:47.834893Z",
"annotation": ""
}
]
dataPoints
name | type | value |
---|---|---|
date | string | date |
value | number | value |
type | string | Actual/Projected |
updatedAtUtc | string | Utc date value for when the point was updated |
Filtering Data
Basic Filtering of DataPoints
A number of filtering options are available for an array of dataPoints based on the type of property you wish to filter by.
Filtering is performed on the TimeSeries
and DataPoints
routes by appending /query={property|filter}
to the url.
element | description |
---|---|
property | name of the dataPoint field, such as type , value , date . |
filter | use the information below to decide which filter best suits your needs. |
e.g. https://api.vantage.informaecon.com/products/Vantage/path/to/result/
query=value|bt20,50
Filter Types
int, long, float, double (all numeric types)
Numbers form the majority of the data you will be collecting so an array of filter options are present:
https://api.vantage.informaecon.com/products/Vantage/path/to/result
/query=value|lt30
https://api.vantage.informaecon.com/products/Vantage/path/to/result
/query=value|bt20,40
Filter | Description | Example | Example would return |
---|---|---|---|
lt{value} |
Less than | lt50 | values less than 50 |
lte{value} |
Less than or equal to | lte10 | values less than or equal to 10 |
gt{value} |
Greater than | gt30.2 | greater than 30.2 |
gte{value} |
Greater than or equal to | gte423.78 | greater than or equal to 423.78 |
bt{min},{max} |
Between two numbers | bt20,50 | values between 20 and 50 |
os{min},{max} |
Outside of two numbers | os20,30 | values less than 20 and greater than 30 |
Strings
https://api.vantage.informaecon.com/products/Vantage/path/to/result
/query=type|tual
Searching for too
will return anything with too
in the text, like too much
, took
, tool
, too big
.
Strings are searchable by partial string match where the text you search for is present anywhere in the field.
e.g. Search for "lazy" would match "The quick brown fox jumped over the lazy dog."
Dates
https://api.vantage.informaecon.com/products/Vantage/path/to/result
/query=date|2017-11-22
to find the dataPoint for that date.
Date searches are exact match based, if you were to search for a date then use the format YYYY-MM-DD (as all dataPoints are logged to 00:00:00 time).
Date Range (where date is available)
https://api.vantage.informaecon.com/products/Vantage/path/to/result
/query=daterange|2016-01-01,2018-01-01
The date range filter is in the format daterange|{oldestDate},{newestDate}
This will search for dataPoints between the dates you input.
Please remember to put the lowest date first!
Special Values
The substitute now
may be used inplace of an actual date value.
Make sure your from date is less than your to date.
https://api.vantage.informaecon.com/products/Vantage/path/to/result
/query=daterange|now-1y,now
Date substitute | performs | example |
---|---|---|
-1d |
back one day | now-1d |
-3w |
back three weeks | now-3w |
-2m |
back two months | now-2m |
-1y |
back one year | now-1y |
+1y |
forward one year | now+1y (for forecast data types) |
+365d |
forward 365 days | now+365d (for forecast data types) |
https://api.vantage.informaecon.com/products/Vantage/path/to/result
/query=daterange|now-365d,now-1w
https://api.vantage.informaecon.com/products/Vantage/path/to/result
/query=daterange|now,now+3y
This date formatting will allow you to use the same url in your links, but will provide rolling data as it is updated, this data will track the date offsets from now
(being the current UTC time) that you use in the url.
e.g.
now-1d
on the 21st of May 2018, will be the 20th, yet on the 23rd, it will be the 22nd when the data is refreshed.
Also, now-1y
on 1st of June 2018, would equate to 1st of June 2017, then on the 30th of August 2019, that same value, when updated, will be 30th August 2018.
Please remember to put the lowest date first!
Using Multiple Filters
https://api.vantage.informaecon.com/products/Vantage/path/to/result
/query=daterange|2016-01-01,2018-01-01;value|gt100
Multiple filters are supported by placing a ;
(semi-colon) separator between filters.
The first example will filter all dataPoints between 2016-01-01 and 2018-01-01 where the value is greater than 100.
https://api.vantage.informaecon.com/products/Vantage/path/to/result
/query=daterange|now-1y,now-1m;value|os100,300
The second example will filter all data between one month ago (rolling date) and one year ago (rolling date) with values less than 100 and values greater than 300
Bulk Filtering [NEW]
Due to popular feedback, in order to assist you retrieving the data you require easier - we have come up with a standardised way of wildcard searching across all data in a single Channel.
User Example Story:
User A wants to retrieve anything relating to corn production
in the US
and Russia
.
Old Solution
User A has to drill down into Region US
, then to commodity Corn
, then cherry pick data relating to production
from all of the returned timeSeries.
User A has to drill down into Region Russia
, then to commodity Corn
, then cherry pick data relating to production
from all of the returned timeSeries.
New Solution
https://api.vantage.informaecon.com/channels/Vantage/channelId
/filtered?wildcards=corn,produc&country=US|Russia
[
{
"resultTime": "196ms",
"filteredBy": "+Regions: US Russia OR +Wildcards: corn produc AND ",
"country": "US",
"docCountApprox": 1764,
"children": [
{
"commodity": "Corn",
"docCountApprox": 1764,
"children": [
{
"metric": "Production - Kentucky",
"docCountApprox": 34,
"children": [
{
"timeSeriesId": "AYP.Corn.US.Production_-_Kentucky.Yearly",
"docCountApprox": 34,
"timeSeriesUrl": "https://api.agribusiness.ihsmarkit.com/timeseries/Vantage/ayp/QVlQLkNvcm4uVVMuUHJvZHVjdGlvbl8tX0tlbnR1Y2t5LlllYXJseQ/",
"description": "Production - Kentucky"
}
]
}
]
}
]
},
{
"country": "Russia",
"docCountApprox": 209,
"children": [
{
"commodity": "Corn",
"docCountApprox": 209,
"children": [
{
"metric": "Production",
"docCountApprox": 22,
"children": [
{
"timeSeriesId": "AYP.Corn.Russia.Production.Yearly",
"docCountApprox": 22,
"timeSeriesUrl": "https://api.agribusiness.ihsmarkit.com/timeseries/Vantage/ayp/QVlQLkNvcm4uUnVzc2lhLlByb2R1Y3Rpb24uWWVhcmx5/",
"description": "Production"
}
]
}
]
}
]
}
]
User A now can go as far as selecting Product and Channel Id, then apply a Bulk Filter to the endpoint...
This /filtered
addition with its parameters allows you to Bulk Get matching time series data, so in one query, you get everything... Sure, it may deliver some more results than you're looking for, but you have less code to write and everything in front of you to inject into your system within one base call.
Basic Parameter Rules
Separation | Char | Means | e.g. |
---|---|---|---|
COMMA | , |
AND | France, Germany = France and Germany |
PIPE | | |
OR | France| Germany = France or Germany |
Parameter breakdown
Parameter | Value Examples | Does what? |
---|---|---|
country | US| Russia |
asks for results from US or Russia |
commodity | cfr| rice |
asks for results within cfr or rice |
wildcards | pork,rind,weekly | asks for results containing pork and rind and weekly |
Notes
wildcards
search a set number of fields within a timeSeries.
At this time, we search the following fields.
- TimeSeriesId
- Description [where available]
- Metric
- State [where available]
- Source [where available]
Searching for any Key Word will search for matches in the following way:
SearchTerm | Pseudo Regexp |
---|---|
word | [w|W]ord |
Christopher | [c|C]hristopher |
USA | [u|U]SA |
Note: The first character is checked in upper and lower case, the rest of the search term is in its original case. This is because some of the words you search for could be at the start of a sentence or within - in the case of all uppercase words, it is assumed that you're looking for specific abbreviations or country intials, such as USA
, GB
or USDA
In the example (which has been cut down for easy reading), you see the second value passed back is:
"filteredBy": "+Country: US Russia OR +Wildcards: corn produc AND ",
this shows you what was interpreted by the query string you sent in.
In this case we are using an OR
operation on US
and Russia
in Country + an AND
operation on corn
and produc
in the wildcards.
Bonus!
You can still refine the Time Series data returned by using the existing filters on a Time Series! (see Basic Filtering of DataPoints)
Bulk Filter Example WorkFlow
I want to get all Yearly Corn Production for the world.
Using my own Software Solution I make a request to:
https://api.vantage.informaecon.com/channels/Vantage/ayp/filtered?wildcards=corn,produc,year
Above, I call the Channel ayp filtered endpoint with the wildcards I'm looking for in an AND operation. So, I'm saying "show me all time series data containing corn AND produc AND year".
In the blink of an eye, I now have all the time series relating to corn, production, producers, products and year, yearly figures.
Each Time Series also provides me a direct TimeSeriesUrl (link) that I can then call in my Software Solution.
I dont want all the years of data that is contained within the IHS Markit Data Cloud, so I decide to only retrieve the last 5 years of data.
On each subsequent automated call into a time series I can add the existing filtering seen above in the section Basic Filtering of DataPoints, so now I can append the following to each TimeSeriesUrl in order to clamp down just the last 5 years of data.
https://api.vantage.informaecon.com/timeseries/Vantage/ayp/QVlQLkNvcm4uVVMuUHJvZHVjdGlvbl8tX0tlbnR1Y2t5LlllYXJseQ/query=daterange|now-5y|now
Note: Using the values now
and now-Xy
i can keep this code rolling in the latest values each time I call the API.
Also, for convenience - there is an ExcelDownloadLink
property, clicking on this will download your search results as an Excel file. This can be performed for the whole search result, or just a single TimeSeries. The Excel file comes with built in document linking from an Index page in order to swiftly navigate to the data you want to look at or incorporate in your solution.
So, now I have a JSON object i can iterate and step into in order to call each timeSeriesUrl. Using something like this, I can pull each timeseries into whatever i need:
//getResult = {get timeseries}
let baseObject = JSON.parse(getResult);
let params = 'query=daterange|now-5y|now';
baseObject.foreach(a => {
a.foreach(b => {
b.foreach(c => {
c.foreach(t => {
var url = t.timeSeriesUrl + params;
this.getTimeseriesDataFromInforma(url)
.then(result => result.json) // chaining
.then(data => doSomethingWithThisCollection(data));
})
})
})
})
Usage Scenarios
The data from api.vantage.informaecon.com is provided 'as is' and therefor is intended for consumption in your own work or 3rd party data applications, an example of which would be Microsoft Excel.
Usage in Excel
Consuming this API from Excel is quite a simple process once you have the timeSeries data Url you want.
Example.
- You want to bring in the Barley Yield values for the USA.
- You find the API endpoint you want by browsing down through the layers until you reach your target.
- copy the url value.
Now you have your endpoint, you load Excel.
- You create a new blank workbook.
-
You go to the Data tab
-
You click 'New Query' then 'From Other Sources' then 'From Web'
-
You paste in the Api Endpoint address (above) and click 'Ok'
-
Excel will then prompt you for an authentication type, so click 'Basic' on the left.
- The first time you do this in Excel, Excel will prompt you for your Vantage user name & password, enter them here and click 'Connect'.
-
Excel then asks you what you want to do, so click 'To table', then 'OK'
- Depending on your selection, Excel will present you with options for what you would like to do next.
Example: for data points
-
Where the data column is just called 'Column1', click the little square icon to the right and click 'OK'
- This brings in the Data points, date, value and type into a table.
-
On the Date column (first column), click on the column header Icon that looks like a Table with a question mark - select 'DateTime' so that Excel knows that these values are indeed dates, otherwise it will process this column as strings.
-
Clicking 'Close & Load' will make Excel import your data to a sheet.
-
Now this data is in Excel, saving and reloading will not affect the data. At any time you may click on the 'Refresh' or 'Refresh All' menu icon, which will reload the data from the Api endpoint.
- From time to time, you may be asked by Excel, to re-enter your credentials (user name and password) for security reasons.
Usage in Google Spreadsheets
See How to import JSON data into Google Spreadsheets in less than 5 minutes for an example.
Usage in Office 365
Click here to view Microsoft's official Office 365 web based Json import documentation
Importing into SQL server
Importing JSON Data from Web Services and Applications into SQL Server
To support many applications, it makes sense for the database to work with JSON data, because it is the built-in way for a JavaScript or TypeScript application to represent object data. It can mean less network traffic, looser coupling, and less need for the application developer to require full access to the base tables of the database. However, it means that the database must do plenty of checks first before importing. Phil Factor explains how it can be easily done.
AGRI API browser
Browse the AGRI API
Enter your {product} AGRI API Username & Password below to connect to the AGRI API and browse the service...
You will only see data channels that you are entitled to within your subscription.
To expand your entitlements, please contact Support
Forgotten password
If you have forgotten your password for the AGRI API, use this form to request a password reset.
When you send, if we find a match for your email address in the system, a reset password email will be sent to you.
Clicking the link within the email will allow you to reset your AGRI API password.
Addendum
json2csharp online convertor
With json2csharp, you can easily turn json responses into .net classes...
Visit Online conversion of json to C# classes or jsonutils.com
E.g.
https://api.vantage.informaecon.com returned json data
{
"id": "barley",
"channelId": "ayp",
"channelUrl": "https://api.vantage.informaecon.com/ayp",
"name": "Barley",
"regions": [
{
"id": "usa-co",
"country": "United States of America",
"locality": "Colorado",
"url": "https://api.vantage.informaecon.com/ayp/:regionIds/usa-co",
"timeSeriesUrl": "https://api.vantage.informaecon.com/ayp/timeseries/barley/usa-co"
},
{
"id": "usa-az",
"country": "United States of America",
"locality": "Arizona",
"url": "https://api.vantage.informaecon.com/ayp/:regionIds/usa-az",
"timeSeriesUrl": "https://api.vantage.informaecon.com/ayp/timeseries/barley/usa-az"
}
]
}
When the json data is converted online, it generates the following C# or VB classes.
C# .Net
{
public string id { get; set; }
public string country { get; set; }
public string locality { get; set; }
public string url { get; set; }
public string timeSeriesUrl { get; set; }
}
public class RootObject
{
public string id { get; set; }
public string channelId { get; set; }
public string channelUrl { get; set; }
public string name { get; set; }
public List
}
VB .Net
Public Property id As String
Public Property country As String
Public Property locality As String
Public Property url As String
Public Property timeSeriesUrl As String
End Class
Public Class Root
Public Property id As String
Public Property channelId As String
Public Property channelUrl As String
Public Property name As String
Public Property regions As Region()
End Class
Which can then be populated using something like:
C# .Net
var root = JsonConvert.DeserializeObject<RootObject>(myReturnedJsonData);
VB .Net
Dim jss As New JavaScriptSerializer()
Dim root = jss.Deserialize(Of RootObject)(myReturnedJsonData)