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.

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

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:
| request_data = {
'collection_name': '<collection_name>', # (1)!
'input_payload': '<your_cft_payload>', # (2)!
'start_date': '<start_date>', # (3)!
'date': '<end_date>' # (4)!
}
|
- The collection name or ID given to the original plot collection
- The input payload in the structure of the Cool Farm Tool payload
- The start date of the period for which the practices data are applicable
- The end date of the period for which the practices data are applicable
With the headers being:
| 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
| 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:
| response = {
{"updated_practices_data": '0x2ac6cda336bf82ea3cdadde78baee651ced0a4093f81e702d68cd49a722db497'
}
|