Farmland Sales and Listings

Ag-Analytics® Farmland Sales API provides users with easy and fast access to filter and find land for sale, complete with the sales and geographic data components to get a detailed description of that land’s value.

Farmland Sales - GET

Ag-Analytics® Farmland Sales API provides users with easy and fast access to filter and find land for sale, complete with the sales and geographic data components to get a detailed description of that land’s value. The data of this service is originally provided by Farmland Finder. Each response item has a full description of the entire sale/listing information. Multiple parcel/land records can belong to one single listing. In the ‘parcels’ parameter in listing, each parcel record gives the detailed description of a certain land/parcel itself.

Please note, the API request format has been edited from POST to GET. Changes will be reflected in the Documentation and Jupyter Notebook.



Farmland Sales Example Response


Click the Jupyter Notebook Static Sample to view a static rendition of this APIs Jupyter Notebook.
Click the Jupyter Notebook Github Repo to access the Jupyter Notebook .ipynb files and
instructions needed in order to run this APIs Jupyter Notebook.

Header Parameters


content-type: "application/json”


Ocp-Apim-Subscription-Key: Subscription keys are given upon purchase

Request Parameters


Parameter Data Type Required? Options Description
State Text Yes Illinois, Indiana, Iowa, Kansas, Michigan, Minnesota, Missouri, Nebraska, North Dakota, Ohio, South Dakota, Wisconsin State of interest. Title cased. Ex. "Michigan" or "Ohio"
County Text No Counties in the above states County of interest. Title cased. Ex. "Osceola" or "Polk" Note: This parameter will be valid only if the State parameter is provided
Bounding_box Text Yes GeoJSON Area of interest in GeoJSON format. Note: Please provide at least one parameter selected from 'State', 'County', and 'Bounding_box'
Status Text Conditional 'Sold', 'For Sale', 'Expired Listing' Sale condition of the property
StartDate Integer Conditional 'yyyy-mm-dd' Searching starting date of the property Sale Date. In format 'yyyy-mm-dd' Note: Required only if Status is 'Sold'
EndDate Integer Yes 'yyyy-mm-dd' Searching starting date of the property Sale Date. In format 'yyyy-mm-dd' Note: Required only if Status is 'Sold'

Response Parameters


Parameter Type Description
status String Status of the API call. ("SUCCESS", "FAILURE", "WARNING")
msg Text ---
Listing Parameter Type Description
Listing_id String The unique ID for each listing(sales).
Entry_Updated Date The date of the listing(sales) information has been updated
Avg_CSR2 Integer The average The Iowa Corn Suitability Rating(Soil Productivity Index)
CRP String If the property joined the Conservation Reserve Program.(‘Yes’ or 'No')
CRP_Acres Float The CRP acres
Total_Acres Float The total acres of the entire sale
Tillable_Acres Float The tillable acres of the sale
Percent_Tillable Float The percent tillable area
Sale_Price Float The total sale price of the sale record
Price_Acre Float The price per acre of the sale record
Status String One of the following values: "For Sale", "Listing Expired", "Sold"
Sale_Condition String One of the following values: "Auction", "Listing"
Listing_Agent String The listing agent name
Broker_URL String The URL link to the broker listing webpage as a string
Buyer String The buyer name as a string
Sale_Date String The sale date string in YYYY-MM-DD format. (When the parcel is still listing, the attribute will be Null)
Taxes_total Float Taxes for the sale as a float
Assessed_Land String If the land/parcel has been assessed
Parcel Parameter Type Description
Parcel_ID String The unique sale ID for each parcel as a string
Parcel String Index of the parcel in one listing(transaction)
Shape String The boundary of the parcel/property in Well Known Text type
GeoJSON String The boundary of the parcel/property in GeoJSON type
Acres Float Area of the parcel
State String The state where the parcel/property locates in
County String The county where the parcel/property locates in
lat_center Float The latitudinal center of the parcel/property as a float value
lng_center Float The longitudinal center of the parcel/property as a float value
range String The range as a string (ex: 26W - always include E or W)
sect String The section as string (ex: 17)
twnshp String The township as a string (ex: 78N - always include N or S)
county_name String The county name as a string (Title cased - for ex: Osceola, Polk, etc.)
state_name String The state name as a string (Title cased - for ex: Michigan)
STATEFP String The FIPS to state level as a string
FIPS String The FIPS to county level as a string



Call API

Request

Request URL

Request parameters

  • (optional)

    State of interest, title cased. Ex. "Michigan"

  • (optional)

    County of interest, title cased. Ex. "Osceola"

  • (optional)

    Sale condition of the property.

Request headers

  • (optional)
  • string

Request body

Responses

200 OK

Code samples

@ECHO OFF

curl -v -X GET "https://ag-analytics.azure-api.net/farmland-sales/?State=Missouri&County=Audrain&Status=For Sale"
-H "Content-Type: application/json"
-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["State"] = "Missouri";
            queryString["County"] = "Audrain";
            queryString["Status"] = "For Sale";
            var uri = "https://ag-analytics.azure-api.net/farmland-sales/?" + 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://ag-analytics.azure-api.net/farmland-sales/");

            builder.setParameter("State", "Missouri");
            builder.setParameter("County", "Audrain");
            builder.setParameter("Status", "For Sale");

            URI uri = builder.build();
            HttpGet request = new HttpGet(uri);
            request.setHeader("Content-Type", "application/json");
            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
            "State": "Missouri",
            "County": "Audrain",
            "Status": "For Sale",
        };
      
        $.ajax({
            url: "https://ag-analytics.azure-api.net/farmland-sales/?" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("Content-Type","application/json");
                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://ag-analytics.azure-api.net/farmland-sales/";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                         @"State=Missouri",
                         @"County=Audrain",
                         @"Status=For Sale",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"GET"];
    // Request headers
    [_request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [_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://ag-analytics.azure-api.net/farmland-sales/');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'Content-Type' => 'application/json',
    'Ocp-Apim-Subscription-Key' => '{subscription key}',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
    'State' => 'Missouri',
    'County' => 'Audrain',
    'Status' => 'For Sale',
);

$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
    'Content-Type': 'application/json',
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.urlencode({
    # Request parameters
    'State': 'Missouri',
    'County': 'Audrain',
    'Status': 'For Sale',
})

try:
    conn = httplib.HTTPSConnection('ag-analytics.azure-api.net')
    conn.request("GET", "/farmland-sales/?%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
    'Content-Type': 'application/json',
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.parse.urlencode({
    # Request parameters
    'State': 'Missouri',
    'County': 'Audrain',
    'Status': 'For Sale',
})

try:
    conn = http.client.HTTPSConnection('ag-analytics.azure-api.net')
    conn.request("GET", "/farmland-sales/?%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://ag-analytics.azure-api.net/farmland-sales/')

query = URI.encode_www_form({
    # Request parameters
    'State' => 'Missouri',
    'County' => 'Audrain',
    'Status' => 'For Sale'
})
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['Content-Type'] = 'application/json'
# 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