Examples

Syntax :

None - as this is the default root URL of the API

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1.1/reports/ -u mars_test_343343: 
Excel: https://marsapi.ams.usda.gov/services/v1.1/reports/

In the above example, the response data will be a Table of Contents of what is available on the API. Use the Slug ID to drill down to a specific report.

Sample of API Table of Contents

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Above is a sample of the Table of Contents pulled into Microsoft XLS. Use the Slug ID field to pull a specific report. 

Syntax :

<Slug ID>

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1.1/reports/1234 -u mars_test_343343: 
Excel: https://marsapi.ams.usda.gov/services/v1.1/reports/1234

In the above example, the response data for 1234 (which is Green City Livestock Auction Replacement Cattle Special - Green City, MO) 

Syntax :

<Slug ID>?q=commodity=<Value>;report_date=mm/dd/yyyy

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1/reports/1280?q=commodity=Feeder%20Cattle;report_begin_date=06/03/2019 -u mars_test_343343: 
Excel: https://marsapi.ams.usda.gov/services/v1/reports/1280?q=commodity=Feeder Cattle;report_begin_date=06/03/2019

In the above example, the response data for 1280 (which is Oklahoma National Stockyards Market) will be filter by Commodity= Feeder Cattle and only show report date 04 JUN 2019. For the cURL example above, denote that when you have a space between word such as 'Feeder Cattle', you will need to place a %20 in between the words.

 
Syntax:

Commodity=<Value>, market_type=<Value>, holdings_current=<Value>,report_end_date=mm/dd/yyyy

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1.1/reports/1095?q=commodity=Cheese;market_type=Cold%20Storage;holdings_current_lbs=94464576;report_end_date=01/15/2018 -u mars_test_343343: 
Excel: https://marsapi.ams.usda.gov/services/v1.1/reports/1095?q=commodity=Cheese;market_type=Cold Storage;holdings_current_lbs=94464576;report_end_date=01/15/2018

In the above example, the response data for the 1095 report will be filter by Commodity=cheese, market_type=Cold%20Storageholdings_current_lbs, and by report_end_date, since there is no sort order available, the response will be sorted automatically by default sort order. 

Syntax :

commodity=<Value>;market_type=<Value>;report_end_date=mm/dd/yyyy:mm/dd/yyyy

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1.1/reports/1095?q=commodity=Cheese;market_type=Cold%20Storage;report_end_date=01/15/2018:02/14/2018 -u mars_test_343343:
Excel: https://marsapi.ams.usda.gov/services/v1.1/reports/1095?q=commodity=Cheese;market_type=Cold Storage;report_end_date=01/15/2018:02/14/2018

In the above example, the response data for the 1095 report will be filter by Commodity=cheese, market_type=Cold%20Storage and by report_end_date (between 2 dates). 

Syntax :

<SLUG ID>?q=commodity=Feeder Cattle

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1.1/reports/1280?q=commodity=Feeder%20Cattle -u mars_test_343343:
Excel: https://marsapi.ams.usda.gov/services/v1.1/reports/1280?q=commodity=Feeder Cattle

In the above example, the response data for report 1280 (which is Oklahoma National Stockyards Market) filtered on commodity of Feeder Cattle

Syntax :

<SLUG ID>?q=commodity=Feeder Cattle;report_begin_date=mm/dd/yyyy:mm/dd/yyyy

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1.1/reports/1280?q=commodity=Feeder%20Cattle;report_begin_date=01/28/2019:02/01/2019 -u mars_test_343343:
Excel: https://marsapi.ams.usda.gov/services/v1.1/reports/1280?q=commodity=Feeder Cattle;report_begin_date=01/28/2019:02/01/2019

In the above example, the response data for report 1280 (which is Oklahoma National Stockyards Market) filtered on commodity of only Feeder Cattle with a date range of 01 JAN 2019 to 01 FEB 2019. 

Syntax :

offices

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1/offices -u mars_test_343343:
Excel: https://marsapi.ams.usda.gov/services/v1/offices

In the above example, the response data will give a full list of Market News offices and the market commodity they collect 

Syntax :

marketTypes

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1/marketTypes -u mars_test_343343:
Excel: https://marsapi.ams.usda.gov/services/v1/marketTypes

In the above example, the response data will give a full list of Market Types and Market Type ID's.

Syntax :

commodities

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1/commodities -u mars_test_343343:
Excel: https://marsapi.ams.usda.gov/services/v1/commodities

In the above example, the response data will give a full list of commodities in MARS along with 'LOV ID's'.

Syntax :

offices/St Joseph

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1/offices/St%20Joseph -u mars_test_343343:
Excel: https://marsapi.ams.usda.gov/services/v1/offices/St Joseph

In the above example, the response data will give a full list of reports that are released by the St. Joseph, MO Market News Office. 

Syntax :

marketTypes/Auction Livestock

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1/marketTypes/Auction%20Livestock -u mars_test_343343:
Excel: https://marsapi.ams.usda.gov/services/v1/marketTypes/Auction Livestock

In the above example, the response data will give a full list of 'Auction Livestock' Market Type regardless of location. 

Syntax :

<Slug ID>?q=report_begin_date=mm/dd/yyyy&allSections=true

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1.1/reports/1975?q=report_begin_date=05/29/2019&allSections=true -u mars_test_343343:
Excel: https://marsapi.ams.usda.gov/services/v1.1/reports/1975?q=report_begin_date=05/29/2019&allSections=true

In the above example, the response data will give a full report of Slug ID 1975 for May 29, 2019 with all Sections of the report included.

Syntax :

<Slug ID>/<Section>?q=report_begin_date=mm/dd/yyyy

Example :

cURL: curl https://marsapi.ams.usda.gov/services/v1.1/reports/1975/Volumes?q=report_begin_date=05/29/2019 -u mars_test_343343:
Excel: https://marsapi.ams.usda.gov/services/v1.1/reports/1975/Volumes?q=report_begin_date=05/29/2019

In the above example, the response data will give partial report of Slug ID 1975 for May 29, 2019 only including the Volume Section of the report.