.. include:: /global.inc .. include:: /banner.rst 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/``. .. http:post:: /crop_product/create/ Create a crop product with the specified data inputs. .. note:: Use an HTML ``
`` element to send this data via a web browser; users will have to fill in additional information to finish creating a crop product :form float growing_area_size: size of growing area, in hectares :form float product_dry_value: product dry weight, in tonnes :form int crop_type: crop type ID, see :http:get:`/crop_type/` **Example request** .. sourcecode:: http 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** .. sourcecode:: http 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/ :reqheader X-Api-Authorisation: API key; see :doc:`authentication` :reqheader X-Api-App-Authorisation: app key; see :doc:`authentication` :statuscode 400: missing or incorrect form data