Skip to content

Upload Plots

The /upload_plots API endpoint allows users to upload data to cloud environments for processing.

It is the step following staging, and is required to make the data available for batch processing.

Uploading data via Dashboard

Uploading data is the second step to uploading data via the dashboard can be done through the Monitoring pane.

Dashboard upload

This step may take a few seconds to a few minutes depending on the data size, but will ultimately provide a success message if the upload was successful.

The uploaded data can then be consulted in the dashboard through the Suppliers pane.

Uploading data using the API

Parameters and Headers

An example of a payload for the /upload_plots endpoint is the following:

1
2
3
request_data = {
    "filename": "<collection_id_from_stage_plots>",
}

With the headers being:

1
2
3
4
headers = {
    'Authorization': "Bearer <authorization_token>",
    'Content-Type': 'application/json'
}

The Authorization header must be replaced by your user token. Check this page for more information on how to authenticate.

Python

In python, you can submit a request in the following way:

upload_plots.py
1
2
3
4
5
6
7
8
9
import requests
import json

response = requests.post("https://epoch-sco2-api.com/upload_plots", 
                         json=request_data, 
                         headers=headers)

json_result = json.loads(response.content)
print(json_result)

Javascript

upload_plots.js
const axios = require('axios');

const request_data = {
    "filename": "<collection_id_or_collection_name_from_stage_plots>",
};

const headers = {
    'Authorization': "Bearer <authorization_token>",
    'Content-Type': 'application/json'
};

axios.post("https://epoch-sco2-api.com/upload_plots", request_data, { headers })
    .then(response => {
        console.log(response.data);
    })
    .catch(error => {
        console.error(error);
    });

Curl

1
2
3
4
curl -X POST "https://epoch-sco2-api.com/upload_plots" \
-H "Authorization: Bearer <authorization_token>" \
-H "Content-Type: application/json" \
-d '{"filename": "<collection_id_from_stage_plots>"}'

Response

The response looks like this:

1
2
3
4
response = {
    "bq_task_id": 'W2GLGAD4TK7LJHPJ4VR6ECLX', # Task ID of the upload task
    "ee_task_id": 'JETBQ7F7WOBOARKVIU6PUM66', # Task ID of the upload task for earth engine
}