API Documentation

Endpoint: http://data.foodsecurityportal.org/
Introduction Click to show

Introduction

Actions

Commodities /commodities

Return a list of all commodities.

Commodity /commodities/:id

Return details on a specific commodity.

Countries /countries

Parameters

Name Required
regions
subregions
find

Return all countries, optionally filtered by region or sub-region. Can search by partial name using the find parameter.

Country /countries/:name

Returns details of a single country, selected by ISO 3 code.

Countryindicators /countries/:name/indicators

Returns list of available indicators for country with links.

Datasource /datasources/:id

Returns details on a specific datasource.

Datasources /datasources

Returns all datasources.

Indicator /indicators/:id

Parameters

Name Required
countries
regions
subregions
startdate
enddate

Returns indicator data for a specific indicator. Optionally filtered by countries, regions, and sub-regions.

Indicators /indicators

Parameters

Name Required
find

Return a list of all indicators. Optional find string will return indicators containing string.

Mediaanalysis /mediaanalysis/:id

Parameters

Name Required
startdate
enddate
region
subregion
country

Description

This API call has no description :-(

Mediaanalysiscommodity /mediaanalysis/:spatialcoverage/:commodityid

Parameters

Name Required
country
region
subregion
startdate
enddate
frequency

Media Analysis query based on a commodity and frequency.
:spatialcoverage should be \'global\', \'country\' or \'region\'.
:commoditycoverage should be either the FSP numeric ID, FAOSTATCode code, or commodity short name.
:frequency should be \'yearly\', \'monthly\', \'weekly\', or \'daily\'. Defaults to daily.

Mediaanalysistype /mediaanalysis

Parameters

Name Required
id

Returns available types of media analysis data.

Price /prices/:id

Parameters

Name Required
country
region
subregion
startdate
enddate

{
"meta": {
"apiVersion": "0.5.1",
"nextLink": "http:\/\/data.foodsecurityportal.org\/prices\/global\/soft_wheat?frequency=daily&pagesize=1&page=2",
"queryTime": 0.0136,
"type": {
"id": "19",
"name_en": "Soft wheat futures daily prices",
"name_es": null,
"name_fr": null,
"description": "Daily settlements for soft wheat futures (where 5,000 bushels ~ 136 Metric Tons). Source: CME",
"unit": "US$\/Kg",
"commodityName_en": "Soft Wheat",
"commodityName_es": null,
"commodityName_fr": null,
"frequency": "daily",
"spatialCoverage": "Global",
"lastYear": "2013",
"lastUpdate": "2014-02-06",
"created": "2014-02-06",
"note": null
},
"datasource": {
"link": "http:\/\/data.foodsecurityportal.org\/datasources\/9",
"name_en": "CME group",
"name_es": null,
"name_fr": null,
"url": "http:\/\/www.cmegroup.com\/",
"division": null
},
"provider": {
"organization": "Food Security portal facilitated by IFPRI",
"website": "http:\/\/www.foodsecurityportal.org",
"contact": "IFPRI-FSP@cgiar.org",
"dateGenerated": "2015-02-24 13:37:27",
"method": "http:\/\/data.foodsecurityportal.org\/prices\/global\/soft_wheat?frequency=daily&pagesize=1"
}
},
"results": [
{
"countryLink": "http:\/\/data.foodsecurityportal.org\/countries",
"region_en": "World",
"commodityName_EN": "Soft Wheat",
"commodityLink": "http:\/\/data.foodsecurityportal.org\/commodities\/1",
"created": "2014-02-25",
"lastUpdate": "2015-01-22",
"data": [
{
"date": "2015-01-20",
"price": "536.00",
"percentageOfChange": "0.75"
}
]
}
]

Pricecommodity /prices/:spatialcoverage/:commodityid

Parameters

Name Required
country
startdate
enddate
pagesize
region
subregion
frequency

Price query based on a commodity and frequency.
:spatialcoverage should be \'global\' or \'country\'.
:commoditycoverage should be either the FSP numeric ID or FAOSTATCode code.
frequency should be \'yearly\', \'monthly\', \'weekly\', \'daily\', defaults to monthly.

Prices /prices

Parameters

Name Required
find
commodity

Returns all price types.

Region /regions/:id

Returns details on a specific region, including contained sub-regions.

Regions /regions

Returns a list of regions.

Returntrigger /returns/:id

Parameters

Name Required
countries
regions
subRegions
startDate
endDate

Returns results for a single return trigger type.

Returntriggercommodity /returns/:spatialcoverage/:commodityid

Parameters

Name Required
country
startdate
enddate
frequency
region
subregion

Price query based on a commodity and frequency.
:spatialcoverage should be \'global\', \'country\' or \'region\'.
:commoditycoverage should be either the FSP numeric ID, FAOSTATCode code, or commodity short name.
:frequency should be \'yearly\', \'monthly\', \'weekly\', \'daily\'. Defaults to monthly.

Returntriggers /returns

Parameters

Name Required
find
interval

Returns listing of returns and triggers.

Errors

400 PRICE_MISSING_COMMODITY

Description

Please specify a commodity.

Error Message

Please specify a commodity.

404 NOT_FOUND

Description

A resource referred to by this call could not be found.

Error Message

The resource could not be found. Please ensure your call is properly formed and that you have the correct resource identifier.

405 GET_ONLY

Description

This error is returned whenever a collection or a resource is called using an unaccepted HTTP method. Only GET calls are allowed.

Error Message

Only GET calls are accepted for this request.

405 NO_POST

Description

This error is returned whenever a collection or a resource prevents the use of the POST method.

Error Message

POST calls are not accepted for this request.

405 NO_PUT

Description

This error is returned whenever someone tries to execute a PUT request on a collection or a resource that prevents PUT requests.

Error Message

PUT calls are not accepted for this request.

422 INVALID_INPUT

Description

There was an issue processing this call. Please check the parameters and try again.

Error Message

There was an issue processing this call. Please check the parameters and try again.

422 UNSUPPORTED_VIEW

Description

The user has requested a view that isn\'t supported by this call.

Error Message

The requested view is not available for this resource. Please check or remove the view parameter.

Output Formats / Mimetypes

csv text/csv
html text/html
js application/javascript | text/javascript
json text/json | application/json | text/plain
printr text/php-printr
xml application/xml | text/xml