Page tree
Skip to end of metadata
Go to start of metadata

Overview

This document outlines creating and using a token for programmatic ECHO requests by client developers. ECHO uses URS usernames and passwords for authentication. Most client developers will be interested in searching our Operations environment, so the hostname used in the Example Request for Partner Test Environment section below would be different based on the table below.

ECHO Environments Table

 

Example Request for Partner Test Environment

 

curl -X POST --header "Content-Type: application/xml" -d "<token><username>sample_username</username><password>sample-password</password><client_id>client_name_of_your_choosing</client_id><user_ip_address>your_origin_ip_address</user_ip_address> <provider>PROV_ID</provider></token>" https://api-test.echo.nasa.gov/echo-rest/tokens

The <provider> Element

The <provider> element in the example above is only used if you are planning on working on behalf of an ECHO provider, client developers should leave it out.

If you have special characters in your password, you will probably need to escape them using a backslash.  You can also use the "file input" option in curl to create a file that looks like:

mytokengenerator.xml
<token>
  <username>sample_username</username>
  <password>sample-password</password>
  <client_id>client_name_of_your_choosing</client_id>
  <user_ip_address>your_origin_ip_address</user_ip_address>
  <provider>PROV_ID</provider>
</token>

Then, the above curl command looks a little bit different:

curl -X POST --header "Content-Type: application/xml" -d @mytokengenerator.xml https://api-test.echo.nasa.gov/echo-rest/tokens

In that case, you don't need to escape anything.

Sample Response

<?xml version="1.0" encoding="UTF-8"?>
<token>
  <id>75E5CEBE-6BBB-2FB5-A613-0368A361D0B6</id>
  <username>sample_username</username>
  <client_id>client_name_of_your_choosing</client_id>
  <user_ip_address>your_origin_ip_address</user_ip_address>
  <provider>PROV_ID</provider>
</token>

 

Related articles