Skip to content

Update Practices Data

The /update_practices_data endpoint allows users to upload or update practices data, in the structure of the Cool Farm Tool payload.

This step validates the CFT payload, and assigns it to a supply based that was staged and uploaded using /stage_plots and /upload_plots.

Staging data via Dashboard

Staging data via the dashboard can be done through the Suppliers pane.

Edit Land Management Details

Click on the Edit Land Management Details button to open the form.

Edit & Save

Fill in the form with the required information and click on the Save button once finished.

Staging data using the API

Parameters and Headers

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

1
2
3
4
5
6
request_data = {
    'collection_name': '<collection_name>',  # (1)!
    'input_payload': '<your_cft_payload>', # (2)!
    'start_date': '<start_date>', # (3)!
    'date': '<end_date>' # (4)!
}
  1. The collection name or ID given to the original plot collection
  2. The input payload in the structure of the Cool Farm Tool payload
  3. The start date of the period for which the practices data are applicable
  4. The end date of the period for which the practices data are applicable

With the headers being:

1
2
3
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:

update_practices_data.py
import requests
import json

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

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

Javascript

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

const request_data = {
    'collection_name': '<collection_name>', 
    'input_payload': '<your_cft_payload>', 
    'start_date': '<start_date>', 
    'date': '<end_date>' 
};

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

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

Curl

1
2
3
4
5
6
7
8
9
curl -X POST "https://epoch-sco2-api.com/update_practices_data" \
     -H "Authorization: Bearer <authorization_token>" \
     -H "Content-Type: application/json" \
     -d '{
           "collection_name": "<collection_name>",
           "input_payload": "<your_cft_payload>",
           "start_date": "<start_date>",
           "date": "<end_date>"
         }'

Response

The response looks like this:

1
2
3
response = {
    {"updated_practices_data": '0x2ac6cda336bf82ea3cdadde78baee651ced0a4093f81e702d68cd49a722db497'
}