Farmland Sales

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.

a). Farmland Sales POST

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 headers

  • (optional)
    string
  • string

Request body

Bounding_Box=%7B%22type%22%3A%22Feature%22%2C%22properties%22%3A%7B%7D%2C%22geometry%22%3A%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B-88.6%2C47.04%5D%2C%5B-88.54%2C47.04%5D%2C%5B-88.54%2C47.1%5D%2C%5B-88.6%2C47.1%5D%2C%5B-88.6%2C47.04%5D%5D%5D%7D%7D&Status=For+Sale

Responses

200 OK

Code samples

@ECHO OFF

curl -v -X POST "https://ag-analytics.azure-api.net/farmland-sales/"
-H "Content-Type: application/x-www-form-urlencoded"
-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://ag-analytics.azure-api.net/farmland-sales/?" + queryString;

            HttpResponseMessage response;

            // Request body
            byte[] byteData = Encoding.UTF8.GetBytes("{body}");

            using (var content = new ByteArrayContent(byteData))
            {
               content.Headers.ContentType = new MediaTypeHeaderValue("< your content type, i.e. application/json >");
               response = await client.PostAsync(uri, content);
            }

        }
    }
}	
// // 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/");


            URI uri = builder.build();
            HttpPost request = new HttpPost(uri);
            request.setHeader("Content-Type", "application/x-www-form-urlencoded");
            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://ag-analytics.azure-api.net/farmland-sales/?" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
                xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
            },
            type: "POST",
            // 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",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"POST"];
    // Request headers
    [_request setValue:@"application/x-www-form-urlencoded" 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/x-www-form-urlencoded',
    'Ocp-Apim-Subscription-Key' => '{subscription key}',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_POST);

// 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/x-www-form-urlencoded',
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.urlencode({
})

try:
    conn = httplib.HTTPSConnection('ag-analytics.azure-api.net')
    conn.request("POST", "/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/x-www-form-urlencoded',
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.parse.urlencode({
})

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


request = Net::HTTP::Post.new(uri.request_uri)
# Request headers
request['Content-Type'] = 'application/x-www-form-urlencoded'
# 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