API-V2 Quick Start Guide

This guide describes some common operations that users can perform using the API-V2 REST (Representational State Transfer) API (Application Programming Interface). For more details about

NOTE: we recommend using the API-V2 interface for programming rather than requesting web site HTML pages, since the API-V2 makes smaller, faster responses (by default, JSON, except in a few special cases), and offers more flexible queries.

Searching for a File or Set of Files

There are many parameters that can help define what you are searching for. Refer to the "content" OpenAPI spec for detailed lists with examples.

Examples

  • search for files to then download (response is a simple HTML list, easily handled by tools like wget)

  • search for information (metadata) about files (default response is JSON)

Downloading Files

  • NOTE: all data downloads require either

    • that you are logged in to the website, if using in internet browser, or
    • a Download Token, if using a script or command line tool.

      substitute the download token for YOUR_TOKEN_HERE in the examples below.

  • NOTE 2: curl by default downloads one file at a time. Refer to its documentation for all the options that it supports.

  • NOTE 3: wget can also download multiple files and directory trees of files. Refer to its documentation for all the options it supports.

Examples

  • download a specific filename

    • from browser

      refer to /api/v2/content/archives/

    • using curl

      curl --data-binary --header "X-Requested-With: XMLHttpRequest" --header "Authorization: Bearer YOUR_TOKEN_HERE" -o YOUR_OUTPUT_FILE_PATH_HERE --create-dirs -C - "https://ladsweb.modaps.eosdis.nasa.gov/api/v2/content/archives/FILENAME_TO_DOWNLOAD"
    • using wget

      wget -e robots=off -m -np -R .html,.tmp -nH --header "X-Requested-With: XMLHttpRequest"  --header "Authorization: Bearer YOUR_TOKEN_HERE" --cut-dirs=3 "https://ladsweb.modaps.eosdis.nasa.gov/api/v2/content/archives/FILENAME_TO_DOWNLOAD" -P .
  • download a file with a specific path

    • from browser

      refer to /api/v2/content/archives/

    • using curl

      curl --data-binary --header "X-Requested-With: XMLHttpRequest" --header "Authorization: Bearer YOUR_TOKEN_HERE" -o YOUR_OUTPUT_FILE_PATH_HERE --create-dirs -C - "https://ladsweb.modaps.eosdis.nasa.gov/api/v2/content/archives/PATH_TO_FILE"
    • using wget

      wget -e robots=off -m -np -R .html,.tmp -nH --header "X-Requested-With: XMLHttpRequest"  --header "Authorization: Bearer YOUR_TOKEN_HERE" --cut-dirs=3 "https://ladsweb.modaps.eosdis.nasa.gov/api/v2/content/archives/PATH_TO_FILE" -P .

Search For and Download Files in One Step

  • NOTE: all data downloads require either

    • that you are logged in to the website, if using in internet browser, or
    • a Download Token, if using a script or command line tool

      substitute the download token for YOUR_TOKEN_HERE in the examples below.

Examples

  • download a set of files that match query parameters

    • using wget

      wget -e robots=off -m -np -R .html,.tmp -nH --header "X-Requested-With: XMLHttpRequest"  --header "Authorization: Bearer YOUR_TOKEN_HERE" --cut-dirs=3 "https://ladsweb.modaps.eosdis.nasa.gov/api/v2/content/archives?YOUR_SEARCH_PARAMS_HERE" -P .

Finding Other Information

Examples