Fetching Metadata Example

In this example, we'll go through how to make a request to the metadata endpoint in Python. We'll do this in two ways, first by requesting all deployments in the system, and second, by requesting data for a specific deployment.

Request metadata for all deployments

To fetch the metadata for all deployments, make a GET request to the bare metadata endpoint.

example_metadata_request.py
import requests
url = 'https://api.cryosphereinnovation.com/public/deployments/'; 
response = requests.get(url, headers={'Authorization':'Bearer YOUR_API_KEY'}).json()
print(response)

The above will return a JSON response with the deployment metadata for all deployments with private=false.

By default, the response is paginated and will only return 10 deployments at a time. You can increase this by adding a page_size query parameter to the url with the maximum number of desired deployments.

url = 'https://api.cryosphereinnovation.com/public/deployments/?page_size=100'; 

In both cases, the deployment metadata is available under the .results key in the returned object. There is also a .count key specifying the total number of deployments in the system and .next and .previous keys with URLs for navigating to the next/previous batch of paginated results.

Request metadata for a specific deployment

To fetch metadata for a specific deployment, add a slug parameter to the request URL.

example_metadata_request.py
import requests
url = 'https://api.cryosphereinnovation.com/public/deployments/300434066157890'; 
response = requests.get(url, headers={'Authorization':'Bearer YOUR_API_KEY'}).json()
print(response)

The slug can be found on the deployment webpage under the "details" tab on the information card. It can also be found by examining the last part of the deployment URL. Taking SIMB3 2023A as an example, the slug is 300434066157890 (URL of https://api.cryosphereinnovation.com/public/deployments/300434066157890).

For SIMB3s, the slug is almost always the IMEI of the instrument deployed. An exception is for redeployments, where the IMEI is ambiguous.