Return to API Services or NWS Text Products Interface.

Documentation for /cgi-bin/afos/retrieve.py

This service returns NWS Text Products from the IEM's database. The database updates in near real-time, so it should be considered a near real-time source with minimal latency.

Changelog

  • 2026-03-09: The METAR service was updated to not consider the IEM generated METARs based on the MADIS HF feed.
  • 2026-01-29: This service is now protected by a query timeout of 60 seconds. You will get a HTTP status of 503.
  • 2025-11-18: Added matches parameter to allow a simple search within candidate text products for a given string. For some products with ambiguous six character pil values and identical issuance center values, this allows further refinement of the search. This is generally only useful for the "faked" PILs used within MOS products.
  • 2025-01-22: Added aviation_afd flag for the specific case of retrieving the "Aviation" section of an Area Forecast Discussion.
  • 2025-01-08: Added some caching due to incessant requests for the same data.

Examples

Return all of the Daily Summary Messages for Des Moines from 1 Jan 2025 to 9 Jan 2025 in text format.

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?limit=9999&pil=DSMDSM&fmt=text&sdate=2025-01-01&edate=2025-01-09

Return the last 5 Daily Summary Messages for Des Moines in text format.

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?limit=5&pil=DSMDSM&fmt=text

Same request, but in HTML format:

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?limit=1&pil=DSMDSM&fmt=html

Return all TORnado warnings issued between 20 and 21 UTC on 27 Apr 2011 as a zip file.

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?sdate=2011-04-27T20:00Z&edate=2011-04-27T21:00Z&pil=TOR&fmt=zip&limit=9999

Return the last Area Forecast Discussion from NWS Des Moines as text

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?pil=AFDDMX

Retrieve recent METAR observations for KDSM, note that this only works for recent data, no archive support with this API.

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?pil=MTRDSM

Same request, but in HTML format:

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?pil=MTRDSM&fmt=html

Use the WAR pil shortcut to retrieve a number of Des Moines products

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?pil=WARDSM

Return the last AFDDMX product in text format

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?pil=AFDDMX&fmt=text

Same request, but in HTML format:

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?pil=AFDDMX&fmt=html

Return a zip file of AFDDMX products during 2024

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?pil=AFDDMX&fmt=zip&sdate=2024-01-01T00:00Z&edate=2024-12-31T23:59Z

Return the aviation section of the latest AFD from NWS Des Moines

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?pil=AFDDMX&aviation_afd=1

Return the LAV MOS for KATL by specifying that KATL should appear within the product text, so to not return the mos for PATL.

https://mesonet.agron.iastate.edu/cgi-bin/afos/retrieve.py?pil=LAVATL&matches=KATL

CGI Arguments

The following table lists the CGI arguments that are accepted by this service. A HTTP GET request is required. Fields of type Multi-Params or CSV value can accept either a comma separated list or multiple parameter and value combinations. For example, ?foo=1&foo=2 is equivalent to ?foo=1,2.

Field Type Description
aviation_afd boolean If set to 1, the returned data will be the 'Aviation' section of an Area Forecast Discussion. This requires the PIL to be an AFD product and a limit of 1 set.
center string The 4 character source iddentifier to limit the search to. This is typically only used when a PIL is ambiguous
dl boolean If set to 1, the returned data will be downloaded as a file
edate string or null The ending timestamp in UTC to limit the database search. This value is exclusive.
fmt string The format of the returned data, either text, html, or zip. The meaning of text is to return something that resembles what would have been sent over the NWS NOAAPort system. The html format is a bit more human readable. The zip format will return a zip file containing the text products, one file per product.
limit integer The number of products to return, default is 1. This number is limited to 9999.
matches string Attempt a simple substring search within candidate products for the given exact string. This is limited functionality for now.
pil Multi-Params or CSV value (required) The 3 to 6 character AFOS ID / Product ID to query for. This is typically the third line of a NWS Text Product. A special case of WAR will return FLS, FFS, AWW, TOR, SVR, FFW, SVS, LSR, SPS, WSW, FFA, WCN, NPW products.
sdate string or null The starting timestamp in UTC to limit the database search. This value is inclusive.
order string The order of the returned products, either 'asc' or 'desc'
ttaaii string The 6 character WMO Header to limit the search to. This is typically only used when a PIL is ambiguous