Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

This page provides practical examples of how to use the EarthScope CLI to retrieve your access token for use within common HTTP command line tools like cURL and Wget.

File Server Access Examples

Your access token can be used to retrieve files from EarthScope’s Data File Server.

Prerequisites

  1. Login: This step is only required once (the first time you run the CLI on your device) unless your access token is deleted from your device.

    es login
  2. Get Access Token: Retrieve your token using es user get-access-token. Add this access token as an Authorization header with your cURL or Wget command.

Using cURL

curl -L -O -f --url https://data.earthscope.org/archive/gnss/rinex/obs/1992/001/algo0010.92d.Z --header "authorization: Bearer $(es user get-access-token)"

cURL Options Explained:

Using Wget

wget https://data.earthscope.org/archive/gnss/rinex/obs/2022/060/p1230600.22d.Z --header "authorization: Bearer $(es user get-access-token)"

Additional Resources

For more file server access examples, see the GAGE Facility’s GPS/GNSS file server access examples.

API Integration Examples

Scripting with Access Tokens

When writing scripts that need to access EarthScope resources, use the CLI commands to retrieve access tokens rather than hardcoding them:

#!/bin/bash
# Good practice: Use CLI to get fresh token
TOKEN=$(es user get-access-token)
curl -H "Authorization: Bearer $TOKEN" \
     "https://api.earthscope.org/beta/user/profile"