Setup and Troubleshoot

All Dataset API code examples require installation of certain packages and authentication from your ESS-DIVE account. This page provides instructions for setting up the Dataset API for your preferred coding language.

For additional information about the API, review the technical documentation at https://api-sandbox.ess-dive.lbl.gov.

ESS-DIVE Test API URL (Sandbox): https://api-sandbox.ess-dive.lbl.gov ESS-DIVE Production API URL: https://api.ess-dive.lbl.gov/ Help Desk: [email protected]

Setup Code

Step 1: Get Authentication Token: Copy your authentication token from ESS-DIVE, then paste it into the code where specified in the example.

Step 2: Setup your code in your preferred coding language as follows.

Setup in Python

Install the following python module into your python environment

$ pip install requests

In a python console or script add the following lines to setup your script.

import requests
import os
import json

token = "<Enter your authorization token here>"
base = "https://api-sandbox.ess-dive.lbl.gov/"
header_authorization =  "bearer {}".format(token)
endpoint = "packages"

Troubleshoot

Python Troubleshooting Tips

This error message indicates your token is either incorrect or expired. Please follow the instructions on the ESS-DIVE Dataset API page to retrieve a new token.

This error message indicates a required field is missing from your JSON. In this case it is the "familyName". Revise your JSON to include the mandatory fields.

This error message indicates the file entered was not found. This could be because you are searching in the wrong directory or because you misrepresented the file name.

Last updated