eMODIS
This eMODIS API provides a Normalized Difference Vegetation Index (NDVI), which quantifies vegetation by measuring the difference between near-infrared (which vegetation strongly reflects) and red light (which vegetation absorbs). Overall, NDVI is a standardized way to measure healthy vegetation. When you have high NDVI values, you have healthier vegetation. When you have low NDVI, you have less or no vegetation.
GET Request eMODIS
Please note, you need to purchase a subscription key to call the API.
Please use the trial version to try now for a limited amount of uses before purchase.
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.
Call API
Request
Request URL
Request parameters
-
The year of which you would like to receive data up to. (e.g. – 2018)
-
(ESRI Polygon shape): The shape information for field in esriGeometryPolygon format. See example request below. Standard open source JavaScript front-end libraries (e.g., Leaflet) can be used to structure the shape.
-
Filter values using modified SG filter.
-
The year you would like the historical range to start. (e.g. 2002 -)
Request headers
-
string
Request body
Responses
200 OK
Representations
Code samples
@ECHO OFF
curl -v -X GET "https://ag-analytics.azure-api.net/eMODIS/?year=2019&shape={"rings":[[[-91.42396,38.285882],[-91.424146,38.285908],[-91.424585,38.285883],[-91.424669,38.285878],[-91.424981,38.2857],[-91.425093,38.285636],[-91.425162,38.285572],[-91.425365,38.285384],[-91.425408,38.285312],[-91.425564,38.285048],[-91.425676,38.284729],[-91.425753,38.284391],[-91.425933,38.284091],[-91.426397,38.283576],[-91.426753,38.283242],[-91.42733,38.282874],[-91.427799,38.28267],[-91.428179,38.282556],[-91.428529,38.282496],[-91.428971,38.282456],[-91.429343,38.282461],[-91.429609,38.282529],[-91.430162,38.282738],[-91.431095,38.283107],[-91.431361,38.283148],[-91.431722,38.283107],[-91.432515,38.282696],[-91.433079,38.282402],[-91.433506,38.281959],[-91.433796,38.28145],[-91.433935,38.280939],[-91.434023,38.28062],[-91.434217,38.280247],[-91.434515,38.279884],[-91.435083,38.279398],[-91.435737,38.278775],[-91.435842,38.278675],[-91.436245,38.278296],[-91.436674,38.278036],[-91.436825,38.277933],[-91.436832,38.278407],[-91.437145,38.278468],[-91.437252,38.278341],[-91.437768,38.278302],[-91.437892,38.284998],[-91.437906,38.285771],[-91.437906,38.285773],[-91.433113,38.285862],[-91.423955,38.28603],[-91.423961,38.286021],[-91.42396,38.285882]],[[-91.436093,38.278766],[-91.43616,38.278913],[-91.43631,38.278942],[-91.436473,38.278917],[-91.436465,38.278761],[-91.436374,38.278687],[-91.436166,38.278647],[-91.436093,38.278766]]],"spatialReference":{"wkid":4326}}&filtered=true&startYear=2002"
-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["year"] = "2019";
queryString["shape"] = "{"rings":[[[-91.42396,38.285882],[-91.424146,38.285908],[-91.424585,38.285883],[-91.424669,38.285878],[-91.424981,38.2857],[-91.425093,38.285636],[-91.425162,38.285572],[-91.425365,38.285384],[-91.425408,38.285312],[-91.425564,38.285048],[-91.425676,38.284729],[-91.425753,38.284391],[-91.425933,38.284091],[-91.426397,38.283576],[-91.426753,38.283242],[-91.42733,38.282874],[-91.427799,38.28267],[-91.428179,38.282556],[-91.428529,38.282496],[-91.428971,38.282456],[-91.429343,38.282461],[-91.429609,38.282529],[-91.430162,38.282738],[-91.431095,38.283107],[-91.431361,38.283148],[-91.431722,38.283107],[-91.432515,38.282696],[-91.433079,38.282402],[-91.433506,38.281959],[-91.433796,38.28145],[-91.433935,38.280939],[-91.434023,38.28062],[-91.434217,38.280247],[-91.434515,38.279884],[-91.435083,38.279398],[-91.435737,38.278775],[-91.435842,38.278675],[-91.436245,38.278296],[-91.436674,38.278036],[-91.436825,38.277933],[-91.436832,38.278407],[-91.437145,38.278468],[-91.437252,38.278341],[-91.437768,38.278302],[-91.437892,38.284998],[-91.437906,38.285771],[-91.437906,38.285773],[-91.433113,38.285862],[-91.423955,38.28603],[-91.423961,38.286021],[-91.42396,38.285882]],[[-91.436093,38.278766],[-91.43616,38.278913],[-91.43631,38.278942],[-91.436473,38.278917],[-91.436465,38.278761],[-91.436374,38.278687],[-91.436166,38.278647],[-91.436093,38.278766]]],"spatialReference":{"wkid":4326}}";
queryString["filtered"] = "true";
queryString["startYear"] = "2002";
var uri = "https://ag-analytics.azure-api.net/eMODIS/?" + 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/eMODIS/");
builder.setParameter("year", "2019");
builder.setParameter("shape", "{"rings":[[[-91.42396,38.285882],[-91.424146,38.285908],[-91.424585,38.285883],[-91.424669,38.285878],[-91.424981,38.2857],[-91.425093,38.285636],[-91.425162,38.285572],[-91.425365,38.285384],[-91.425408,38.285312],[-91.425564,38.285048],[-91.425676,38.284729],[-91.425753,38.284391],[-91.425933,38.284091],[-91.426397,38.283576],[-91.426753,38.283242],[-91.42733,38.282874],[-91.427799,38.28267],[-91.428179,38.282556],[-91.428529,38.282496],[-91.428971,38.282456],[-91.429343,38.282461],[-91.429609,38.282529],[-91.430162,38.282738],[-91.431095,38.283107],[-91.431361,38.283148],[-91.431722,38.283107],[-91.432515,38.282696],[-91.433079,38.282402],[-91.433506,38.281959],[-91.433796,38.28145],[-91.433935,38.280939],[-91.434023,38.28062],[-91.434217,38.280247],[-91.434515,38.279884],[-91.435083,38.279398],[-91.435737,38.278775],[-91.435842,38.278675],[-91.436245,38.278296],[-91.436674,38.278036],[-91.436825,38.277933],[-91.436832,38.278407],[-91.437145,38.278468],[-91.437252,38.278341],[-91.437768,38.278302],[-91.437892,38.284998],[-91.437906,38.285771],[-91.437906,38.285773],[-91.433113,38.285862],[-91.423955,38.28603],[-91.423961,38.286021],[-91.42396,38.285882]],[[-91.436093,38.278766],[-91.43616,38.278913],[-91.43631,38.278942],[-91.436473,38.278917],[-91.436465,38.278761],[-91.436374,38.278687],[-91.436166,38.278647],[-91.436093,38.278766]]],"spatialReference":{"wkid":4326}}");
builder.setParameter("filtered", "true");
builder.setParameter("startYear", "2002");
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
"year": "2019",
"shape": "{"rings":[[[-91.42396,38.285882],[-91.424146,38.285908],[-91.424585,38.285883],[-91.424669,38.285878],[-91.424981,38.2857],[-91.425093,38.285636],[-91.425162,38.285572],[-91.425365,38.285384],[-91.425408,38.285312],[-91.425564,38.285048],[-91.425676,38.284729],[-91.425753,38.284391],[-91.425933,38.284091],[-91.426397,38.283576],[-91.426753,38.283242],[-91.42733,38.282874],[-91.427799,38.28267],[-91.428179,38.282556],[-91.428529,38.282496],[-91.428971,38.282456],[-91.429343,38.282461],[-91.429609,38.282529],[-91.430162,38.282738],[-91.431095,38.283107],[-91.431361,38.283148],[-91.431722,38.283107],[-91.432515,38.282696],[-91.433079,38.282402],[-91.433506,38.281959],[-91.433796,38.28145],[-91.433935,38.280939],[-91.434023,38.28062],[-91.434217,38.280247],[-91.434515,38.279884],[-91.435083,38.279398],[-91.435737,38.278775],[-91.435842,38.278675],[-91.436245,38.278296],[-91.436674,38.278036],[-91.436825,38.277933],[-91.436832,38.278407],[-91.437145,38.278468],[-91.437252,38.278341],[-91.437768,38.278302],[-91.437892,38.284998],[-91.437906,38.285771],[-91.437906,38.285773],[-91.433113,38.285862],[-91.423955,38.28603],[-91.423961,38.286021],[-91.42396,38.285882]],[[-91.436093,38.278766],[-91.43616,38.278913],[-91.43631,38.278942],[-91.436473,38.278917],[-91.436465,38.278761],[-91.436374,38.278687],[-91.436166,38.278647],[-91.436093,38.278766]]],"spatialReference":{"wkid":4326}}",
"filtered": "true",
"startYear": "2002",
};
$.ajax({
url: "https://ag-analytics.azure-api.net/eMODIS/?" + $.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://ag-analytics.azure-api.net/eMODIS/";
NSArray* array = @[
// Request parameters
@"entities=true",
@"year=2019",
@"shape={"rings":[[[-91.42396,38.285882],[-91.424146,38.285908],[-91.424585,38.285883],[-91.424669,38.285878],[-91.424981,38.2857],[-91.425093,38.285636],[-91.425162,38.285572],[-91.425365,38.285384],[-91.425408,38.285312],[-91.425564,38.285048],[-91.425676,38.284729],[-91.425753,38.284391],[-91.425933,38.284091],[-91.426397,38.283576],[-91.426753,38.283242],[-91.42733,38.282874],[-91.427799,38.28267],[-91.428179,38.282556],[-91.428529,38.282496],[-91.428971,38.282456],[-91.429343,38.282461],[-91.429609,38.282529],[-91.430162,38.282738],[-91.431095,38.283107],[-91.431361,38.283148],[-91.431722,38.283107],[-91.432515,38.282696],[-91.433079,38.282402],[-91.433506,38.281959],[-91.433796,38.28145],[-91.433935,38.280939],[-91.434023,38.28062],[-91.434217,38.280247],[-91.434515,38.279884],[-91.435083,38.279398],[-91.435737,38.278775],[-91.435842,38.278675],[-91.436245,38.278296],[-91.436674,38.278036],[-91.436825,38.277933],[-91.436832,38.278407],[-91.437145,38.278468],[-91.437252,38.278341],[-91.437768,38.278302],[-91.437892,38.284998],[-91.437906,38.285771],[-91.437906,38.285773],[-91.433113,38.285862],[-91.423955,38.28603],[-91.423961,38.286021],[-91.42396,38.285882]],[[-91.436093,38.278766],[-91.43616,38.278913],[-91.43631,38.278942],[-91.436473,38.278917],[-91.436465,38.278761],[-91.436374,38.278687],[-91.436166,38.278647],[-91.436093,38.278766]]],"spatialReference":{"wkid":4326}}",
@"filtered=true",
@"startYear=2002",
];
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://ag-analytics.azure-api.net/eMODIS/');
$url = $request->getUrl();
$headers = array(
// Request headers
'Ocp-Apim-Subscription-Key' => '{subscription key}',
);
$request->setHeader($headers);
$parameters = array(
// Request parameters
'year' => '2019',
'shape' => '{"rings":[[[-91.42396,38.285882],[-91.424146,38.285908],[-91.424585,38.285883],[-91.424669,38.285878],[-91.424981,38.2857],[-91.425093,38.285636],[-91.425162,38.285572],[-91.425365,38.285384],[-91.425408,38.285312],[-91.425564,38.285048],[-91.425676,38.284729],[-91.425753,38.284391],[-91.425933,38.284091],[-91.426397,38.283576],[-91.426753,38.283242],[-91.42733,38.282874],[-91.427799,38.28267],[-91.428179,38.282556],[-91.428529,38.282496],[-91.428971,38.282456],[-91.429343,38.282461],[-91.429609,38.282529],[-91.430162,38.282738],[-91.431095,38.283107],[-91.431361,38.283148],[-91.431722,38.283107],[-91.432515,38.282696],[-91.433079,38.282402],[-91.433506,38.281959],[-91.433796,38.28145],[-91.433935,38.280939],[-91.434023,38.28062],[-91.434217,38.280247],[-91.434515,38.279884],[-91.435083,38.279398],[-91.435737,38.278775],[-91.435842,38.278675],[-91.436245,38.278296],[-91.436674,38.278036],[-91.436825,38.277933],[-91.436832,38.278407],[-91.437145,38.278468],[-91.437252,38.278341],[-91.437768,38.278302],[-91.437892,38.284998],[-91.437906,38.285771],[-91.437906,38.285773],[-91.433113,38.285862],[-91.423955,38.28603],[-91.423961,38.286021],[-91.42396,38.285882]],[[-91.436093,38.278766],[-91.43616,38.278913],[-91.43631,38.278942],[-91.436473,38.278917],[-91.436465,38.278761],[-91.436374,38.278687],[-91.436166,38.278647],[-91.436093,38.278766]]],"spatialReference":{"wkid":4326}}',
'filtered' => 'true',
'startYear' => '2002',
);
$url->setQueryVariables($parameters);
$request->setMethod(HTTP_Request2::METHOD_GET);
// Request body
$request->setBody("{body}");
try
{
$response = $request->send();
echo $response->getBody();
}
catch (HttpException $ex)
{
echo $ex;
}
?>
########### Python 2.7 #############
import httplib, urllib, base64
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.urlencode({
# Request parameters
'year': '2019',
'shape': '{"rings":[[[-91.42396,38.285882],[-91.424146,38.285908],[-91.424585,38.285883],[-91.424669,38.285878],[-91.424981,38.2857],[-91.425093,38.285636],[-91.425162,38.285572],[-91.425365,38.285384],[-91.425408,38.285312],[-91.425564,38.285048],[-91.425676,38.284729],[-91.425753,38.284391],[-91.425933,38.284091],[-91.426397,38.283576],[-91.426753,38.283242],[-91.42733,38.282874],[-91.427799,38.28267],[-91.428179,38.282556],[-91.428529,38.282496],[-91.428971,38.282456],[-91.429343,38.282461],[-91.429609,38.282529],[-91.430162,38.282738],[-91.431095,38.283107],[-91.431361,38.283148],[-91.431722,38.283107],[-91.432515,38.282696],[-91.433079,38.282402],[-91.433506,38.281959],[-91.433796,38.28145],[-91.433935,38.280939],[-91.434023,38.28062],[-91.434217,38.280247],[-91.434515,38.279884],[-91.435083,38.279398],[-91.435737,38.278775],[-91.435842,38.278675],[-91.436245,38.278296],[-91.436674,38.278036],[-91.436825,38.277933],[-91.436832,38.278407],[-91.437145,38.278468],[-91.437252,38.278341],[-91.437768,38.278302],[-91.437892,38.284998],[-91.437906,38.285771],[-91.437906,38.285773],[-91.433113,38.285862],[-91.423955,38.28603],[-91.423961,38.286021],[-91.42396,38.285882]],[[-91.436093,38.278766],[-91.43616,38.278913],[-91.43631,38.278942],[-91.436473,38.278917],[-91.436465,38.278761],[-91.436374,38.278687],[-91.436166,38.278647],[-91.436093,38.278766]]],"spatialReference":{"wkid":4326}}',
'filtered': 'true',
'startYear': '2002',
})
try:
conn = httplib.HTTPSConnection('ag-analytics.azure-api.net')
conn.request("GET", "/eMODIS/?%s" % params, "{body}", headers)
response = conn.getresponse()
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))
####################################
########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64
headers = {
# Request headers
'Ocp-Apim-Subscription-Key': '{subscription key}',
}
params = urllib.parse.urlencode({
# Request parameters
'year': '2019',
'shape': '{"rings":[[[-91.42396,38.285882],[-91.424146,38.285908],[-91.424585,38.285883],[-91.424669,38.285878],[-91.424981,38.2857],[-91.425093,38.285636],[-91.425162,38.285572],[-91.425365,38.285384],[-91.425408,38.285312],[-91.425564,38.285048],[-91.425676,38.284729],[-91.425753,38.284391],[-91.425933,38.284091],[-91.426397,38.283576],[-91.426753,38.283242],[-91.42733,38.282874],[-91.427799,38.28267],[-91.428179,38.282556],[-91.428529,38.282496],[-91.428971,38.282456],[-91.429343,38.282461],[-91.429609,38.282529],[-91.430162,38.282738],[-91.431095,38.283107],[-91.431361,38.283148],[-91.431722,38.283107],[-91.432515,38.282696],[-91.433079,38.282402],[-91.433506,38.281959],[-91.433796,38.28145],[-91.433935,38.280939],[-91.434023,38.28062],[-91.434217,38.280247],[-91.434515,38.279884],[-91.435083,38.279398],[-91.435737,38.278775],[-91.435842,38.278675],[-91.436245,38.278296],[-91.436674,38.278036],[-91.436825,38.277933],[-91.436832,38.278407],[-91.437145,38.278468],[-91.437252,38.278341],[-91.437768,38.278302],[-91.437892,38.284998],[-91.437906,38.285771],[-91.437906,38.285773],[-91.433113,38.285862],[-91.423955,38.28603],[-91.423961,38.286021],[-91.42396,38.285882]],[[-91.436093,38.278766],[-91.43616,38.278913],[-91.43631,38.278942],[-91.436473,38.278917],[-91.436465,38.278761],[-91.436374,38.278687],[-91.436166,38.278647],[-91.436093,38.278766]]],"spatialReference":{"wkid":4326}}',
'filtered': 'true',
'startYear': '2002',
})
try:
conn = http.client.HTTPSConnection('ag-analytics.azure-api.net')
conn.request("GET", "/eMODIS/?%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/eMODIS/')
query = URI.encode_www_form({
# Request parameters
'year' => '2019',
'shape' => '{"rings":[[[-91.42396,38.285882],[-91.424146,38.285908],[-91.424585,38.285883],[-91.424669,38.285878],[-91.424981,38.2857],[-91.425093,38.285636],[-91.425162,38.285572],[-91.425365,38.285384],[-91.425408,38.285312],[-91.425564,38.285048],[-91.425676,38.284729],[-91.425753,38.284391],[-91.425933,38.284091],[-91.426397,38.283576],[-91.426753,38.283242],[-91.42733,38.282874],[-91.427799,38.28267],[-91.428179,38.282556],[-91.428529,38.282496],[-91.428971,38.282456],[-91.429343,38.282461],[-91.429609,38.282529],[-91.430162,38.282738],[-91.431095,38.283107],[-91.431361,38.283148],[-91.431722,38.283107],[-91.432515,38.282696],[-91.433079,38.282402],[-91.433506,38.281959],[-91.433796,38.28145],[-91.433935,38.280939],[-91.434023,38.28062],[-91.434217,38.280247],[-91.434515,38.279884],[-91.435083,38.279398],[-91.435737,38.278775],[-91.435842,38.278675],[-91.436245,38.278296],[-91.436674,38.278036],[-91.436825,38.277933],[-91.436832,38.278407],[-91.437145,38.278468],[-91.437252,38.278341],[-91.437768,38.278302],[-91.437892,38.284998],[-91.437906,38.285771],[-91.437906,38.285773],[-91.433113,38.285862],[-91.423955,38.28603],[-91.423961,38.286021],[-91.42396,38.285882]],[[-91.436093,38.278766],[-91.43616,38.278913],[-91.43631,38.278942],[-91.436473,38.278917],[-91.436465,38.278761],[-91.436374,38.278687],[-91.436166,38.278647],[-91.436093,38.278766]]],"spatialReference":{"wkid":4326}}',
'filtered' => 'true',
'startYear' => '2002'
})
if query.length > 0
if uri.query && uri.query.length > 0
uri.query += '&' + query
else
uri.query = query
end
end
request = Net::HTTP::Get.new(uri.request_uri)
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request body
request.body = "{body}"
response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
http.request(request)
end
puts response.body