Fetching Data Example

In this example, we'll step through how to programmatically fetch data from Cryosphere Innovation deployments using the data endpoint in Python.

In a deviation from the metadata example, data can only be fetched from single deployments. If you need data from several deployments, you must make multiple requests.

Request data from a deployment

To fetch the data from a deployment, make a GET request to the data endpoint with a data_uuid for the deployment. The data_uuid can be found from the Instant Query panel on the deployment webpage.

example_data_request.py
import requests
url = 'https://api.cryosphereinnovation.com/public/deployment/data/e11478e8-8bda-4494-a796-08b82334dfa0'; 
response = requests.get(url, headers={'Authorization':'Bearer YOUR_API_KEY'}).json()
print(response)

The above will return a JSON with all deployment data for the deployment specified.

At the time of writing (September 2023), the data endpoint will always return all rows in the deployment database. You can, however, request only certain fields. Say you only want the air_temp or ctd_conductivity values for a given deployment.

example_data_request.py
import requests
url = 'https://api.cryosphereinnovation.com/public/deployment/data/e11478e8-8bda-4494-a796-08b82334dfa0/?field=air_temp&field=ctd_conductivity'; 
response = requests.get(url, headers={'Authorization':'Bearer YOUR_API_KEY'}).json()
print(response)

This will return a JSON, which when decomposed is a list of objects, each with keys air_temp and ctd_conductivity. There is also a _id parameter which is internal and unique.