Apps, Widgets and APIs: Tap into existing tech to streamline your - - PowerPoint PPT Presentation
Apps, Widgets and APIs: Tap into existing tech to streamline your - - PowerPoint PPT Presentation
Apps, Widgets and APIs: Tap into existing tech to streamline your programs Marian Weaver, FMC Dar Knipe, Market Maker Chris Seeger, Iowa State University Who We Are: Marian Weaver Metrics Program Manager Two priorities for FMC are to: 1)
Metrics is a data collection and reporting system that empowers market managers to be in control of their data, and to transform that data into actionable information. Marian Weaver Metrics Program Manager Two priorities for FMC are to: 1) Professionalize the industry through the use of best in class tools 2) Help markets grow and thrive through the use of data-driven decisions Farmspread provides a comprehensive online management platform for Farmers Markets, helping to streamline operations while promoting a national directory of markets, vendors and products.
Who We Are:
- The Metrics development roadmap had planned for vendor management tools to be built into Metrics,
to further expand the functionality of Metrics for users.
- After some exploratory development, we decided that this was more than FMC could take on, so we
looked for other ways to offer this functionality to Metrics users.
- FMC met Farmspread in November of 2017, and it became apparent that each of us were moving in
the direction that the other had already tackled, so rather than compete, we decided to collaborate.
- What followed was an API, which allows markets to use Farmspread for vendor applications and
market management, and have that data transfer directly into Metrics. Collect data once, use it twice.
- Markets that originally just had data for operations, are now expanding that usage into automated
analysis and promotion as a result of our API.
A history of how we came to this partnership How a partnership fixed a problem
What is an API, anyway?
API: Application Programming Interface In English: A program written to communicate data from one website/server to another. What is does: APIs allow for websites and companies to share data across the internet, based on a shared set of parameters that both companies have.
Current Data Points:
- Market Information
- Vendor Profile Data
Future Data Points:
- Market Sales
- Vendor Sales
- Market Attendance
- Real Time Weather
API
API currently supports 60% of all statistics available in Metrics; by next year it will be over 80%
API
What content are you sharing via API?
Current Data Points:
- Market Information
- Vendor Profile Data
Future Data Points:
- Market Sales
- Vendor Sales
- Market Attendance
- Real Time Weather
What does this look like to market managers?
API
How is it working out?
- We started the project with three markets that were interested in piloting the API; our
goal was for ten for our first season.
- The API was completed in May of 2018, missing the vendor application deadlines for
many markets.
- However, throughout the season, we acquired 17 more markets that utilized the API;
many of them were winter season markets preparing for later this year.
- As of today, we have 20 markets actively using the API, and over 400 vendors, almost
20% of all vendors represented in the Metrics system, and we have at least 20 more markets in line for the 2019 season.
Th The A e API Solu Solutio ion
- A registration and log in system for farmers market managers
and farmers to use with all collaborating directories
- When a user updates a profile it updates all the directories.
- Accounts / profiles can be accessed from any of the web sites of
collaborating organizations.
- Designed to be compatible with the USDA Farmers Market
Directory.
- Shared data administrative tools
The ISUEO Indicators Program is built upon a collection
- f APIs and a network of databases (the Indicators Portal)
that store and share data to a variety of products.
Anatomy of an API Request
- An API is often an external
resource (endpoint), capable of accepting and responding to
- requests. Often written in Node,
Ruby, Java or ASP.NET etc.
Endpoint Parameters Result https://api.ipify.org ?format=json {"ip":"98.207.254.136"} ?format=json callback({"ip":"98.207.254.136"}); ?format=jsonp&callback=getip getip({"ip":"98.207.254.136"}); <nothing specified> 98.207.254.136
- Check the ‘developers’ link on website footers or in about for API
documentation and URL.
- Test samples and search Stack Exchange for help with syntax errors
Anatomy of an API Response
- Some APIs provide access to an ‘Application’ or data. Web
mapping API’s examples: Google Maps, Leaflet, Open Layers, Mapbox
- RESTful APIs can provide various data output formats for
the client to consume.
- JSON, XML, CSV response can be used with a webmap, chart
- r other data visualization.
JSON (minified and hard to read)
{"zip_codes":[{"zip_code":"50156","distance":13.336,"city":"Madrid","state":"IA"},{"zi p_code":"50134","distance":14.124,"city":"Kelley","state":"IA"},{"zip_code":"50152"," distance":9.112,"city":"Luther","state":"IA"},{"zip_code":"50013","distance":13.316,"ci ty":"Ames","state":"IA"},{"zip_code":"50011","distance":12.446,"city":"Ames","state": "IA"},{"zip_code":"50012","distance":11.912,"city":"Ames","state":"IA"},{"zip_code":"5 0031","distance":14.649,"city":"Beaver","state":"IA"},{"zip_code":"50010","distance": 14.633,"city":"Ames","state":"IA"},{"zip_code":"50212","distance":10.885,"city":"Ogde n","state":"IA"},{"zip_code":"50014","distance":9.112,"city":"Ames","state":"IA"},{"zip _code":"50099","distance":2.589,"city":"Boone","state":"IA"},{"zip_code":"50037","dis tance":2.472,"city":"Boone","state":"IA"},{"zip_code":"50036","distance":0,"city":"Boo ne","state":"IA"},{"zip_code":"50105","distance":11.757,"city":"Gilbert","state":"IA
JSON (formatted and easier to read)
{ "zip_codes": [ { "zip_code": "50156", "distance": 13.336, "city": "Madrid", "state": "IA" }, { "zip_code": "50134", "distance": 14.124,
https://www.zipcodeapi.com/API
US Census Bureau API
- Many API’s utilizing three primary
underlying services
- Census Data API (Key required)
- Tiger Web REST Service (ArcGIS geometry)
- Geocoder REST Service (10,000 record limit)
Geocode: 1307 Florida Ave, Ames, IA 50014 Single Return: Lat/Long; State, County, Tract, Block Batch Return: CSV of Lat/Long Census API data formatted into a report. Tiger web returns GeoJSON. Geocoder provides address service.
Weather API’s
- Iowa Environmental Mesonet
- Data sets for time/location
- WMS map tiles
- Weather summaries
- Open Weather Map
- Requires Key
- Wide variety of data responses
- Paid versions provide more features!
- Dark Sky
- Requires Key
- Time machine requests
- 1,000 free requests per day
http://api.openweathermap.org/data/2.5/weather?q=AMES, IOWA&APPID={key}&units=imperial
{"coord":{"lon":-93.62,"lat":42.03},"weather":[{"id":804,"main":"Clouds", "description":"overcast clouds","icon":"04n"}],"base":"stations","main": {"temp":59.88,"pressure":1024,"humidity":77,"temp_min":56.66,"temp_ma x":62.96},"visibility":16093,"wind":{"speed":9.17,"deg":60},"clouds":{"all":9 0},"dt":1536376500,"sys":{"type":1,"id":849,"message":0.0034,"country":"U S","sunrise":1536407251,"sunset":1536453349},"id":4846834,"name":"Ame s","cod":200}
USDA QuickStats API
- An on-line database containing
- fficial published aggregate
estimates related to U.S. agricultural production.
- Requires a Key
- API request below returns JSON of
2012 Apple production in Boone County, Iowa.
https://quickstats.nass.usda.gov/api/api_GET/?key= {key}&commodity_desc=APPLES&year=2012&state _alpha=IA&county_name=BOONE&format=JSON
Iowa State University is currently using multiple API data sources data to develop a producer/market report.