Build API Command
Build an API command - three parts
API commands can be incorporated into scripts or used at the command line via the Mac terminal window, Command Prompt window on Windows, or on Linux systems.
Program Base URL Keywords and Values curl https://api.daac.asf.alaska.edu/services/search/param?platform=R1\&absoluteOrbit=25234\&output=CSV
Windows Example curl “https://api.daac.asf.alaska.edu/services/search/param?platform=R1&absoluteOrbit=25234&output=CSV” > myfilename.csv
Hint: Copying and pasting quotation marks causes errors for Windows users. Delete and re-type the quotes after pasting.
1) Choose a File Transfer Program and options
Both WGET and cURL are often installed on Linux systems. cURL is part of the Mac OS, and WGET can be installed. MS-Windows OS does not come with either installed, but both can be downloaded. cURL is easier to set up on a Windows machine.
Searches can be done in the browser. Paste just the URL and keywords into a browser to search, visualize, or get a metalink file for downloading data. Connect keywords with "&" when using the browser. A file is returned, or you can open results in Google Earth to visualize.
Send all search results to a file
WGET option '-O myfilename' or cURL 'https://.... > myfilename' will send all search results into a file. To download data from ASF, use the .metalink extension on your filename. The metalink output is default for ASF searches, but can be explicitly called with keyword output=METALINK.
Example - query results sent to a metalink file:
wget -O myfilename.metalink https://api.daac.asf.alaska.edu/services/search/param?intersectsWith=point%28-119.543+37.925%29\&platform=ALOS\&output=metalink
curl https://api.daac.asf.alaska.edu/services/search/param?granule_list=ALPSRP074606580,ALPSRP021910740,ALPSRP085800750 >myfilename.metalink
Hint: Copy/pastes of examples that span multiple lines introduce error for Mac/Linux users. Copy and paste one line at a time.
Windows Example curl “https://api.daac.asf.alaska.edu/services/search/param?granule_list=ALPSRP074606580,ALPSRP021910740,ALPSRP085800750” > myfilename.metalink
2) Use the Base URL
The ASF API URL is
3) Choose Keywords
Keywords are used to find the desired data. Use as many or as few keywords as needed.
|Keyword||Description and Values|
This is an ASF / JAXA frame reference. See also 'frame'.
|output||Format of the API search results returned. If not specified, default return is METALINK for ASF API.
Values: CSV, JSON, KML,METALINK
Remote sensing platform that acquired the data.
Values: A3, AI, AS, E1, E2, J1, ERS-1, ERS-2, JERS-1, R1, UA, AIRMOSS, AIRSAR, ALOS, ERS-1, ERS-2, JERS-1, RADARSAT-1, SEASAT, Sentinel-1A, UAVSAR
·A"?" separates the URL from the keywords.
·The keywords are joined by "\&" for command line in Mac/Linux or "&" in browser and Windows.
·The base URL and keywords may not have any spaces.
·Some keywords contain characters that must be encoded.
·Keywords are case sensitive.
Keyword Character Encoding:
URLs may not contain spaces, or parentheses. Some keywords, such as intersectsWith, have parentheses and spaces. Those characters must be encoded as shown in the table below.
|URL Symbol||Replace with ASCII|
|space||remove spaces in URL or use '%20'. Use '+' in keyword values|
For a complete list of URL codes, please see URL Encoding Reference.
Example - encoding intersectsWith=point(-119.543 37.925) --> intersectsWith=point%28-119.543+37.925%29
Keywords may contain a single value or a range of values, depending on the requirements of the particular keyword. For example, "frame=300,310-350" contains both a single value and a range. The geographic area to be searched can be defined using either the older polygon keyword, or the newer intersectswith. Intersectswith has the advantage of allowing a line, a point, or a multi-area search in addition to a single polygon.
4) Put it All Together - Examples
Search curl https://api.daac.asf.alaska.edu/services/search/param?platform=r1\&asfframe=300\&output=CSV > myfilename.csv Visualize wget -O myfilename.kml https://api.daac.asf.alaska.edu/services/search/param?granule_list=ALPSRP074606580,ALPSRP077086550\&output=KML Visualize - in browser and Google Earth
wget -c -O myfilename.metalink https://api.daac.asf.alaska.edu/services/search/param?granule_list=ALPSRP074606580,ALPSRP077086550\&output=METALINK
Search curl “https://api.daac.asf.alaska.edu/services/search/param?platform=r1&asfframe=300&output=CSV” > myfilename.csv Visualize curl “https://api.daac.asf.alaska.edu/services/search/param?granule_list=ALPSRP074606580,ALPSRP077086550&output=KML” >myfilename.kml Download curl -L “https://api.daac.asf.alaska.edu/services/search/param?granule_list=ALPSRP074606580,ALPSRP077086550&output=METALINK” >myfilename.metalink