Farmers Markets in New York State API

In the past decade the number of farmers markets in New York State has grown at a rapid rate. The dataset published on the Department website contains information detailing the time and location of community farmers markets as well as the name and phone number of the market manager.

Getting Started

All communication with the API is done through HTTPS, and errors are communicated through HTTP response codes. Available response types include JSON, XML, and CSV, which are selectable by the "extension" on API requests or by HTTP Accepts headers.

This documentation also includes inline, runable examples. Click on any link that contains a gear symbol next to it to run that example live against the Farmers Markets in New York State API API.

App Tokens

All requests should include an app token that identifies your application, and each application should have its own unique app token. A limited number of requests can be made without an app token, but they are subject to much lower throttling limits than request that do include one. If you don't have an app token yet, click the button to the right to sign up for one.

Once you have an app token, you can include it with your request either by using the X-App-Token HTTP header, or by passing it via the $app_token parameter on your URL.

Response Codes

One of the following response codes will be returned with every request:

  1. 200Successful request.
  2. 202Request processing. You can retry your request, and when it's complete, you'll get a 200 instead.
  3. 400Bad request
  4. 401Unauthorized. You're not authorized to access this resource.
  5. 404Not found. The resource requested doesn't exist.
  6. 429Too Many Requests. The client has made too many requests and is currently being rate limited.
  7. 500Server errors. Our bad!

Code Samples

#!/usr/bin/env ruby

require 'net/https'
uri = URI('https://data.ny.gov/resource/farmersmarkets.json?$limit=5')

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER

request = Net::HTTP::Get.new(uri.request_uri)
request.add_field('X-App-Token', ARGV[0])

response = http.request(request)
puts response.code
puts response.body
#!/usr/bin/env python

import sys
import requests

r = requests.get('https://data.ny.gov/resource/farmersmarkets.json?$limit=5', headers={'X-App-Token': sys.argv[1]})
print r.status_code
print r.text
request = require 'request'
options = uri: 'https://data.ny.gov/resource/farmersmarkets.json?$$app_token=APP_TOKEN&$limit=5'
request options, (err, response, body) ->  console.log body
#!/bin/sh 

curl --header "X-App-Token: $1" "https://data.ny.gov/resource/farmersmarkets.json?$limit=5"

Fields

The following fields are available on the Farmers Markets in New York State API API.

county

Human Name: County
Type: text
County the Farmers’ Market is located in

Examples

Retrieve all records with county equal to Yates:
Retrieve all records with county equal to Yates:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with county equal to Yates:

Retrieve all records that are greater than Albany:

Retrieve all records with county equal to Yates:

Retrieve all records where county is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(county, 47.598177,-122.33448, 1000)

market_name

Human Name: Market Name
Type: text
Name of the Farmers’ Market

Examples

Retrieve all records with market_name equal to Yates Co. Co-op Farm & Craft Market:
Retrieve all records with market_name equal to Yates Co. Co-op Farm & Craft Market:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with market_name equal to Yates Co. Co-op Farm & Craft Market:

Retrieve all records that are greater than 125th Street Fresh Connect Farmers' Market:

Retrieve all records with market_name equal to Yates Co. Co-op Farm & Craft Market:

Retrieve all records where market_name is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(market_name, 47.598177,-122.33448, 1000)

location

Human Name: Location
Type: text
General place or common name of the location where the market is set up

Examples

Retrieve all records with location equal to YWCA NENY44 Washington Ave., Schenectady:
Retrieve all records with location equal to YWCA NENY44 Washington Ave., Schenectady:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with location equal to YWCA NENY44 Washington Ave., Schenectady:

Retrieve all records that are greater than 10094 Rt. 9W:

Retrieve all records with location equal to YWCA NENY44 Washington Ave., Schenectady:

Retrieve all records where location is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(location, 47.598177,-122.33448, 1000)

address_line_1

Human Name: Address Line 1
Type: text
1st address line of the physical address for this farmer's market location

Examples

Retrieve all records with address_line_1 equal to W Main St and Homestead St:
Retrieve all records with address_line_1 equal to W Main St and Homestead St:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with address_line_1 equal to W Main St and Homestead St:

Retrieve all records that are greater than 1004 Main St:

Retrieve all records with address_line_1 equal to W Main St and Homestead St:

Retrieve all records where address_line_1 is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(address_line_1, 47.598177,-122.33448, 1000)

city

Human Name: City
Type: text
City name for this farmer's market location

Examples

Retrieve all records with city equal to Yonkers:
Retrieve all records with city equal to Yonkers:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with city equal to Yonkers:

Retrieve all records that are greater than Adams Center:

Retrieve all records with city equal to Yonkers:

Retrieve all records where city is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(city, 47.598177,-122.33448, 1000)

state

Human Name: State
Type: text
State abbreviation for the physical address of this farmer's market location

Examples

Retrieve all records with state equal to NY:
Retrieve all records with state equal to NY:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with state equal to NY:

Retrieve all records that are greater than NY:

Retrieve all records with state equal to NY:

Retrieve all records where state is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(state, 47.598177,-122.33448, 1000)

zip

Human Name: Zip
Type: number
Zip code for the physical address of this farmer's market location

Examples

Retrieve all records with zip equal to 19069:
Retrieve all records with zip equal to 19069:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with zip equal to 19069:

Retrieve all records that are greater than 10002:

Retrieve all records with zip equal to 19069:

Retrieve all records where zip is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(zip, 47.598177,-122.33448, 1000)

contact

Human Name: Contact
Type: text
Contact name for this farmer's market location

Examples

Retrieve all records with contact equal to Zoe Baker:
Retrieve all records with contact equal to Zoe Baker:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with contact equal to Zoe Baker:

Retrieve all records that are greater than Aaron Munzer:

Retrieve all records with contact equal to Zoe Baker:

Retrieve all records where contact is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(contact, 47.598177,-122.33448, 1000)

phone

Human Name: Phone
Type: text
Phone number for this farmer's market location

Examples

Retrieve all records with phone equal to 9178938801:
Retrieve all records with phone equal to 9178938801:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with phone equal to 9178938801:

Retrieve all records that are greater than 2122046518:

Retrieve all records with phone equal to 9178938801:

Retrieve all records where phone is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(phone, 47.598177,-122.33448, 1000)

market_link

Human Name: Market Link
Type: url
Website or other link to this market’s online presence; not available for all locations

Examples

Retrieve all records with market_link equal to url: https://www.facebook.com/pages/New-Cassel-Farmers-Market/138769932883107:
Retrieve all records with market_link equal to url: https://www.facebook.com/pages/New-Cassel-Farmers-Market/138769932883107:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with market_link equal to url: https://www.facebook.com/pages/New-Cassel-Farmers-Market/138769932883107:

Retrieve all records that are greater than url: http://bccmarket.wordpress.com:

Retrieve all records with market_link equal to url: https://www.facebook.com/pages/New-Cassel-Farmers-Market/138769932883107:

Retrieve all records where market_link is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(market_link, 47.598177,-122.33448, 1000)

operation_hours

Human Name: Operation Hours
Type: text
Day and Hours the market is open

Examples

Retrieve all records with operation_hours equal to Wed-Sun 12pm-5pm:
Retrieve all records with operation_hours equal to Wed-Sun 12pm-5pm:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with operation_hours equal to Wed-Sun 12pm-5pm:

Retrieve all records that are greater than 1st & 3rd Saturday 10am - 2pm:

Retrieve all records with operation_hours equal to Wed-Sun 12pm-5pm:

Retrieve all records where operation_hours is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(operation_hours, 47.598177,-122.33448, 1000)

operation_season

Human Name: Operation Season
Type: text
Month and day when the market opens and closes for the year

Examples

Retrieve all records with operation_season equal to Year-Round:
Retrieve all records with operation_season equal to Year-Round:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with operation_season equal to Year-Round:

Retrieve all records that are greater than April 14-December 19:

Retrieve all records with operation_season equal to Year-Round:

Retrieve all records where operation_season is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(operation_season, 47.598177,-122.33448, 1000)

fmnp

Human Name: FMNP
Type: text
Y: Market is part of the WIC/Senior Farmers Market Nutrition Program

Examples

Retrieve all records with fmnp equal to Y:
Retrieve all records with fmnp equal to Y:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with fmnp equal to Y:

Retrieve all records that are greater than N:

Retrieve all records with fmnp equal to Y:

Retrieve all records where fmnp is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(fmnp, 47.598177,-122.33448, 1000)

operation_months_code

Human Name: Operating Months
Type: text
P=Spring(operating in April or May) M=Summer(operating in June, July, Aug, Sept, Oct, Nov) X=Extended Season(operating in Dec) W=Winter(operating in Jan, Feb, March) YR=Year-round(continually operating at the same location all year long)

Examples

Retrieve all records with operation_months_code equal to YR:
Retrieve all records with operation_months_code equal to YR:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with operation_months_code equal to YR:

Retrieve all records that are greater than M:

Retrieve all records with operation_months_code equal to YR:

Retrieve all records where operation_months_code is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(operation_months_code, 47.598177,-122.33448, 1000)

latitude

Human Name: Latitude
Type: number

Examples

Retrieve all records with latitude equal to 44.99029:
Retrieve all records with latitude equal to 44.99029:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with latitude equal to 44.99029:

Retrieve all records that are greater than 40.57542:

Retrieve all records with latitude equal to 44.99029:

Retrieve all records where latitude is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(latitude, 47.598177,-122.33448, 1000)

longitude

Human Name: Longitude
Type: number

Examples

Retrieve all records with longitude equal to -71.94424:
Retrieve all records with longitude equal to -71.94424:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with longitude equal to -71.94424:

Retrieve all records that are greater than -79.57812:

Retrieve all records with longitude equal to -71.94424:

Retrieve all records where longitude is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(longitude, 47.598177,-122.33448, 1000)

snap_status

Human Name: EBT/SNAP
Type: text
Y=Market supports EBT/SNAP; EBT- Electronic Benefit Transfer, SNAP-Supplemental Nutrition Assistance Program

Examples

Retrieve all records with snap_status equal to Y:
Retrieve all records with snap_status equal to Y:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with snap_status equal to Y:

Retrieve all records that are greater than N:

Retrieve all records with snap_status equal to Y:

Retrieve all records where snap_status is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(snap_status, 47.598177,-122.33448, 1000)

location_points

Human Name: Location Points
Type: location

Examples

Retrieve all records with location_points equal to longitude: -77.05365, latitude: 42.66095:
Retrieve all records with location_points equal to longitude: -77.05365, latitude: 42.66095:

Retrieve all records that occurred before 2012-08-10:

Retrieve all records with location_points equal to longitude: -77.05365, latitude: 42.66095:

Retrieve all records that are greater than longitude: -74.03254, latitude: 42.70149:

Retrieve all records with location_points equal to longitude: -77.05365, latitude: 42.66095:

Retrieve all records where location_points is within 1 kilometer of Seattle, WA (47.598177,-122.33448):

https://data.ny.gov/resource/farmersmarkets.json?$where=within_circle(location_points, 47.598177,-122.33448, 1000)