Sending information to the CFT with the API
This topic guide explains how to send information to be saved in the Cool Farm Tool.
All URLs start with https://app.coolfarmtool.org/api/v1/
.
- POST /crop_product/create/
Create a crop product with the specified data inputs.
Note
Use an HTML
<form>
element to send this data via a web browser; users will have to fill in additional information to finish creating a crop product- Form Parameters
float growing_area_size – size of growing area, in hectares
float product_dry_value – product dry weight, in tonnes
int crop_type – crop type ID, see
GET /crop_type/
Example request
POST /crop_product/create/ HTTP/1.1 Host: app.coolfarmtool.org Accept: application/json Content-Type: application/json X-APP-Authorization: ... X-API-Authorization: ... growing_area_size=100&product_dry_value=100&crop_type=1
Example response
HTTP/1.1 302 FOUND Date: ... Server: WSGIServer/0.1 Python/2.7.14 Vary: Cookie, Accept-Language X-Frame-Options: SAMEORIGIN Content-Type: text/html; charset=utf-8 Set-Cookie: csrftoken=...; ... sessionid=...; ... Location: https://app.coolfarmtool.org/crop_product/fsa/
- Request Headers
X-Api-Authorisation – API key; see Authentication
X-Api-App-Authorisation – app key; see Authentication
- Status Codes
400 Bad Request – missing or incorrect form data