Field Trends API
API change historyThis API offers users the ability to inform critical crop growth trends based on three years of data, to provide insights on crop history and weather at a field level.
- Monthly temperatures - minimum, maximum and average
- Monthly total growing degree days - base 5.5°C (applicable to wheat and other cereals)
- Monthly rainfall
- Monthly days of air frost
- Crops grown in this field in recent years.
Request
Request URL
Request parameters
-
string
Request headers
Request body
Responses
200 OK
Search location matches a field and an identifier is returned.
Representations
{
"_links": {
"ag:api:field-facts": {
"href": "https://api.agrimetrics.co.uk/field-facts/FIELD_ID"
},
"ag:api:field-trends": {
"href": "https://api.agrimetrics.co.uk/field-trends/FIELD_ID"
},
"ag:api:field-forecasts": {
"href": "https://api.agrimetrics.co.uk/field-forecasts/FIELD_ID"
},
"self": {
"href": "https://api.agrimetrics.co.uk/field-trends/FIELD_ID"
}
},
"@context": "https://api.agrimetrics.co.uk/field-trends/context",
"@id": "https://data.agrimetrics.co.uk/fields/FIELD_ID",
"hasMonthlyMeanTemperature": {
"@type": "Dataseries",
"hasDimension": "http://data.agrimetrics.co.uk/dimensions/mean-temperature",
"hasFrequency": "http://data.agrimetrics.co.uk/frequencies/monthly",
"hasUnit": "http://data.agrimetrics.co.uk/units/celsius",
"hasDatapoint": [
{
"@type": "Datapoint",
"value": 14.8,
"year": 2018,
"month": 12
}
]
},
"hasMonthlyMinimumTemperature": {
"@type": "Dataseries",
"hasDimension": "http://data.agrimetrics.co.uk/dimensions/min-temperature",
"hasFrequency": "http://data.agrimetrics.co.uk/frequencies/monthly",
"hasUnit": "http://data.agrimetrics.co.uk/units/celsius",
"hasDatapoint": [
{
"@type": "Datapoint",
"value": -5.7,
"year": 2018,
"month": 12
}
]
},
"hasMonthlyMaximumTemperature": {
"@type": "Dataseries",
"hasDimension": "http://data.agrimetrics.co.uk/dimensions/max-temperature",
"hasFrequency": "http://data.agrimetrics.co.uk/frequencies/monthly",
"hasUnit": "http://data.agrimetrics.co.uk/units/celsius",
"hasDatapoint": [
{
"@type": "Datapoint",
"value": 18.9,
"year": 2018,
"month": 12
}
]
},
"hasMonthlyTotalRainfall": {
"@type": "Dataseries",
"hasDimension": "http://data.agrimetrics.co.uk/dimensions/rainfall",
"hasFrequency": "http://data.agrimetrics.co.uk/frequencies/monthly",
"hasUnit": "http://data.agrimetrics.co.uk/units/millimetre",
"hasDatapoint": [
{
"@type": "Datapoint",
"value": 1.2,
"year": 2018,
"month": 12
}
]
},
"hasMonthlyDaysOfGroundFrost": {
"@type": "Dataseries",
"hasDimension": "http://data.agrimetrics.co.uk/dimensions/days-of-ground-frost",
"hasFrequency": "http://data.agrimetrics.co.uk/frequencies/monthly",
"hasUnit": "http://data.agrimetrics.co.uk/units/days",
"hasDatapoint": [
{
"@type": "Datapoint",
"value": 1.2,
"year": 2018,
"month": 12
}
]
},
"hasMonthlyDaysOfAirFrost": {
"@type": "Dataseries",
"hasDimension": "http://data.agrimetrics.co.uk/dimensions/days-of-air-frost",
"hasFrequency": "http://data.agrimetrics.co.uk/frequencies/monthly",
"hasUnit": "http://data.agrimetrics.co.uk/units/days",
"hasDatapoint": [
{
"@type": "Datapoint",
"value": 1.2,
"year": 2018,
"month": 12
}
]
},
"hasMonthlyGrowingDegreeDays": {
"@type": "Dataseries",
"hasDimension": "http://data.agrimetrics.co.uk/dimensions/growing-degree-days",
"hasFrequency": "http://data.agrimetrics.co.uk/frequencies/monthly",
"hasUnit": "http://data.agrimetrics.co.uk/units/degree-days",
"hasDatapoint": [
{
"@type": "Datapoint",
"value": 11.2,
"year": 2018,
"month": 12
}
]
},
"hasSownCrop": [
{
"@type": "http://data.agrimetrics.co.uk/ontologies/agricultural-plant/YOXebXpkakF6D1",
"label": "Wheat",
"hasSowingSeason": "http://data.agrimetrics.co.uk/seasons/spring",
"harvestYear": 2017
}
]
}
{
"type": "object",
"properties": {
"_links": {
"type": "object",
"description": "HAL links to other Fields API for this field.",
"properties": {
"ag:api:field-facts": {
"type": "object",
"description": "Link to Field Facts information for this field.",
"properties": {
"href": {
"type": "string",
"format": "uri",
"example": "https://api.agrimetrics.co.uk/field-facts/FIELD_ID"
}
}
},
"ag:api:field-trends": {
"type": "object",
"description": "Link to Field Trends information for this field.",
"properties": {
"href": {
"type": "string",
"format": "uri",
"example": "https://api.agrimetrics.co.uk/field-trends/FIELD_ID"
}
}
},
"ag:api:field-forecasts": {
"type": "object",
"description": "Link to Field Forecasts information for this field.",
"properties": {
"href": {
"type": "string",
"format": "uri",
"example": "https://api.agrimetrics.co.uk/field-forecasts/FIELD_ID"
}
}
},
"self": {
"type": "object",
"properties": {
"href": {
"type": "string",
"format": "uri",
"example": "https://api.agrimetrics.co.uk/field-trends/FIELD_ID"
}
}
}
}
},
"@context": {
"type": "string",
"description": "Field Finder JSON-LD context",
"format": "url",
"example": "https://api.agrimetrics.co.uk/field-trends/context"
},
"@id": {
"type": "string",
"description": "Unique identifier for this field, assigned by Agrimetrics.",
"format": "url",
"example": "https://data.agrimetrics.co.uk/fields/FIELD_ID"
},
"hasMonthlyMeanTemperature": {
"type": "object",
"description": "Monthly average of the daily average air temperatures. Specified by year and month (1-12). Values listed for the past 3 complete calendar years.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Dataseries"
},
"hasDimension": {
"type": "string",
"format": "uri",
"description": "Dataseries dimension (mean temperature).",
"example": "http://data.agrimetrics.co.uk/dimensions/mean-temperature"
},
"hasFrequency": {
"type": "string",
"format": "uri",
"description": "Dataseries frequency (monthly).",
"example": "http://data.agrimetrics.co.uk/frequencies/monthly"
},
"hasUnit": {
"type": "string",
"format": "uri",
"description": "Dataseries unit (degrees Celsius).",
"example": "http://data.agrimetrics.co.uk/units/celsius"
},
"hasDatapoint": {
"type": "array",
"description": "All datapoints of the dataseries.",
"items": {
"type": "object",
"description": "Datapoint date and value.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Datapoint"
},
"value": {
"type": "number",
"description": "Monthly mean temperature.",
"example": 14.8
},
"year": {
"type": "number",
"description": "Year of the datapoint",
"example": 2018
},
"month": {
"type": "number",
"description": "Month of the datapoint (1-based)",
"example": 12
}
}
}
}
}
},
"hasMonthlyMinimumTemperature": {
"type": "object",
"description": "Monthly average of the daily minimum air temperature values. Specified by year and month (1-12). Values listed for the past 3 complete calendar years.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Dataseries"
},
"hasDimension": {
"type": "string",
"format": "uri",
"description": "Dataseries dimension (minimum temperature).",
"example": "http://data.agrimetrics.co.uk/dimensions/min-temperature"
},
"hasFrequency": {
"type": "string",
"format": "uri",
"description": "Dataseries frequency (monthly).",
"example": "http://data.agrimetrics.co.uk/frequencies/monthly"
},
"hasUnit": {
"type": "string",
"format": "uri",
"description": "Dataseries unit (degrees Celsius).",
"example": "http://data.agrimetrics.co.uk/units/celsius"
},
"hasDatapoint": {
"type": "array",
"description": "All datapoints of the dataseries.",
"items": {
"type": "object",
"description": "Datapoint date and value.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Datapoint"
},
"value": {
"type": "number",
"description": "Monthly minimum temperature.",
"example": -5.7
},
"year": {
"type": "number",
"description": "Year of the datapoint",
"example": 2018
},
"month": {
"type": "number",
"description": "Month of the datapoint (1-based)",
"example": 12
}
}
}
}
}
},
"hasMonthlyMaximumTemperature": {
"type": "object",
"description": "Monthly average of the daily maximum air temperature values. Specified by year and month (1-12). Values listed for the past 3 complete calendar years.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Dataseries"
},
"hasDimension": {
"type": "string",
"format": "uri",
"description": "Dataseries dimension (maximum temperature).",
"example": "http://data.agrimetrics.co.uk/dimensions/max-temperature"
},
"hasFrequency": {
"type": "string",
"format": "uri",
"description": "Dataseries frequency (monthly).",
"example": "http://data.agrimetrics.co.uk/frequencies/monthly"
},
"hasUnit": {
"type": "string",
"format": "uri",
"description": "Dataseries unit (degrees Celsius).",
"example": "http://data.agrimetrics.co.uk/units/celsius"
},
"hasDatapoint": {
"type": "array",
"description": "All datapoints of the dataseries.",
"items": {
"type": "object",
"description": "Datapoint date and value.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Datapoint"
},
"value": {
"type": "number",
"description": "Monthly maximum temperature.",
"example": 18.9
},
"year": {
"type": "number",
"description": "Year of the datapoint",
"example": 2018
},
"month": {
"type": "number",
"description": "Month of the datapoint (1-based)",
"example": 12
}
}
}
}
}
},
"hasMonthlyTotalRainfall": {
"type": "object",
"description": "Monthly total of the daily total values for rainfall. Specified by year and month (1-12). Values listed for the past 3 complete calendar years.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Dataseries"
},
"hasDimension": {
"type": "string",
"format": "uri",
"description": "Dataseries dimension (rainfall).",
"example": "http://data.agrimetrics.co.uk/dimensions/rainfall"
},
"hasFrequency": {
"type": "string",
"format": "uri",
"description": "Dataseries frequency (monthly).",
"example": "http://data.agrimetrics.co.uk/frequencies/monthly"
},
"hasUnit": {
"type": "string",
"format": "uri",
"description": "Dataseries unit (millimetres).",
"example": "http://data.agrimetrics.co.uk/units/millimetre"
},
"hasDatapoint": {
"type": "array",
"description": "All datapoints of the dataseries.",
"items": {
"type": "object",
"description": "Datapoint date and value.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Datapoint"
},
"value": {
"type": "number",
"description": "Monthly total rainfall.",
"example": 1.2
},
"year": {
"type": "number",
"description": "Year of the datapoint",
"example": 2018
},
"month": {
"type": "number",
"description": "Month of the datapoint (1-based)",
"example": 12
}
}
}
}
}
},
"hasMonthlyDaysOfGroundFrost": {
"type": "object",
"description": "Monthly total of the number of days when ground frost occurred. Specified by year and month (1-12). Values listed for the past 3 complete calendar years. The values are interpolated from weather observations onto a 5km grid, giving decimal values.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Dataseries"
},
"hasDimension": {
"type": "string",
"format": "uri",
"description": "Dataseries dimension (days of ground frost).",
"example": "http://data.agrimetrics.co.uk/dimensions/days-of-ground-frost"
},
"hasFrequency": {
"type": "string",
"format": "uri",
"description": "Dataseries frequency (monthly).",
"example": "http://data.agrimetrics.co.uk/frequencies/monthly"
},
"hasUnit": {
"type": "string",
"format": "uri",
"description": "Dataseries unit (days).",
"example": "http://data.agrimetrics.co.uk/units/days"
},
"hasDatapoint": {
"type": "array",
"description": "All datapoints of the dataseries.",
"items": {
"type": "object",
"description": "Datapoint date and value.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Datapoint"
},
"value": {
"type": "number",
"description": "Monthly days of ground frost.",
"example": 1.2
},
"year": {
"type": "number",
"description": "Year of the datapoint",
"example": 2018
},
"month": {
"type": "number",
"description": "Month of the datapoint (1-based)",
"example": 12
}
}
}
}
}
},
"hasMonthlyDaysOfAirFrost": {
"type": "object",
"description": "Monthly total of the number of days when air frost occurred. Specified by year and month (1-12). Values listed for the past 3 complete calendar years. The values are interpolated from weather observations onto a 5km grid, giving decimal values.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Dataseries"
},
"hasDimension": {
"type": "string",
"format": "uri",
"description": "Dataseries dimension (days of air frost).",
"example": "http://data.agrimetrics.co.uk/dimensions/days-of-air-frost"
},
"hasFrequency": {
"type": "string",
"format": "uri",
"description": "Dataseries frequency (monthly).",
"example": "http://data.agrimetrics.co.uk/frequencies/monthly"
},
"hasUnit": {
"type": "string",
"format": "uri",
"description": "Dataseries unit (days).",
"example": "http://data.agrimetrics.co.uk/units/days"
},
"hasDatapoint": {
"type": "array",
"description": "All datapoints of the dataseries.",
"items": {
"type": "object",
"description": "Datapoint date and value.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Datapoint"
},
"value": {
"type": "number",
"description": "Monthly days of air frost.",
"example": 1.2
},
"year": {
"type": "number",
"description": "Year of the datapoint",
"example": 2018
},
"month": {
"type": "number",
"description": "Month of the datapoint (1-based)",
"example": 12
}
}
}
}
}
},
"hasMonthlyGrowingDegreeDays": {
"type": "object",
"description": "Monthly sum of growing degree days. Specified by year and month (1-12). Values listed for the past 3 complete calendar years. The values are calculated from maximum and minumum temperature from weather observations using 5.5°C as base temperature.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Dataseries"
},
"hasDimension": {
"type": "string",
"format": "uri",
"description": "Dataseries dimension (growing degree days).",
"example": "http://data.agrimetrics.co.uk/dimensions/growing-degree-days"
},
"hasFrequency": {
"type": "string",
"format": "uri",
"description": "Dataseries frequency (monthly).",
"example": "http://data.agrimetrics.co.uk/frequencies/monthly"
},
"hasUnit": {
"type": "string",
"format": "uri",
"description": "Dataseries unit (degree days).",
"example": "http://data.agrimetrics.co.uk/units/degree-days"
},
"hasDatapoint": {
"type": "array",
"description": "All datapoints of the dataseries.",
"items": {
"type": "object",
"description": "Datapoint date and value.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type.",
"example": "Datapoint"
},
"value": {
"type": "number",
"description": "Monthly sum of growing degree days.",
"example": 11.2
},
"year": {
"type": "number",
"description": "Year of the datapoint",
"example": 2018
},
"month": {
"type": "number",
"description": "Month of the datapoint (1-based)",
"example": 12
}
}
}
}
}
},
"hasSownCrop": {
"type": "array",
"description": "List of crops grown in previous years.",
"items": {
"type": "object",
"description": "Crop sown in this field for each of the three previous years (where data is available). The level of data may vary by year; more detailed categorisation is typically available for more recent years.",
"properties": {
"@type": {
"type": "string",
"description": "Ontology type. This is an agricultural plant within an Agrimetrics ontology; all values are subclasses of a common 'Agricultural Plant' class and may represent species, specific varieties, or in some cases aggregations of different plants that can form a meaningful common group (e.g. Short Rotation Coppice).",
"example": "http://data.agrimetrics.co.uk/ontologies/agricultural-plant/YOXebXpkakF6D1"
},
"label": {
"type": "string",
"description": "Common name of the crop.",
"example": "Wheat"
},
"hasSowingSeason": {
"type": "string",
"format": "uri",
"description": "Season when the crop was sown. This may not be specified where the data is unknown or not relevant - primarily included where a crop can be sown in different seasons (e.g. differentiating Spring wheat from Winter wheat). Note - the sowing season may be in a different year than the harvest.",
"example": "http://data.agrimetrics.co.uk/seasons/spring"
},
"harvestYear": {
"type": "number",
"description": "Year the crop was harvested",
"example": 2017
}
}
}
}
}
}
400 Bad Request
Missing id parameter.
Representations
{
"statusCode": 0.0,
"message": "string"
}
{
"type": "object",
"properties": {
"statusCode": {
"type": "number",
"description": "HTTP error code"
},
"message": {
"type": "string",
"description": "Developer friendly error message"
}
}
}
404 Not Found
No field with given identifier were found.
Representations
{
"statusCode": 0.0,
"message": "string"
}
{
"type": "object",
"properties": {
"statusCode": {
"type": "number",
"description": "HTTP error code"
},
"message": {
"type": "string",
"description": "Developer friendly error message"
}
}
}
Code samples
@ECHO OFF
curl -v -X GET "https://api.agrimetrics.co.uk/field-trends/{id}"
-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}");
var uri = "https://api.agrimetrics.co.uk/field-trends/{id}?" + 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.agrimetrics.co.uk/field-trends/{id}");
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
};
$.ajax({
url: "https://api.agrimetrics.co.uk/field-trends/{id}?" + $.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.agrimetrics.co.uk/field-trends/{id}";
NSArray* array = @[
// Request parameters
@"entities=true",
];
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.agrimetrics.co.uk/field-trends/{id}');
$url = $request->getUrl();
$headers = array(
// Request headers
'Ocp-Apim-Subscription-Key' => '{subscription key}',
);
$request->setHeader($headers);
$parameters = array(
// Request parameters
);
$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({
})
try:
conn = httplib.HTTPSConnection('api.agrimetrics.co.uk')
conn.request("GET", "/field-trends/{id}?%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({
})
try:
conn = http.client.HTTPSConnection('api.agrimetrics.co.uk')
conn.request("GET", "/field-trends/{id}?%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.agrimetrics.co.uk/field-trends/{id}')
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