Saving assessments using the CFT

This topic guide explains how to send data to the CFT’s creation modules.

Warning

Users should be warned and advised that this feature is currently in development, and you may notice unusual behavior when using it.

Please send anything you notice to tech@coolfarmtool.org and we will investigate it as soon as possible.

Note

  • Data schemas are available for reference

  • This version of the API has significant changes to these methods; see changelog

All URLs start with /api/v1/.

Crop assessment

Note

When saving a crop product to the database, and you want to use the crop product as a dairy feed item, you will need to create (or use an existing crop product), either in the user interface or using the guide below, ensuring that you send your choice of feed_type. Choices are available on the Feed_components item page

"crop": {
    "type": "Potato",
    "feed_type": null, // Add the name or ID of the feed type here
    "field_size": {
        "value": 100,
        "unit": "ha"
    },
},
POST /crop_product/

Create a crop product and save it to the database

Example request

POST /crop_product/ HTTP/1.1
Host: app.coolfarmtool.org
Accept: application/json
Content-Type: application/json
[
  {
    "farm": {
      "country": "United States of America",
      "territory": "Alabama",
      "climate": "Warm Temperate Dry",
      "average_temperature": {
        "value": 15,
        "unit": "°C"
      },
      "soil_characteristics": "Sandy Soils",
      "farm_identifier": "",
      "latitude": 32.318,
      "longitude": -86.902
    },
    "crop": {
      "type": "Potato",
      "harvesting_year": 2022,
      "feed_type": null,
      "field_size": {
        "value": 100,
        "unit": "ha"
      },
      "soil": {
        "texture_id": 1,
        "organic_matter_id": 2,
        "drainage_id": 1,
        "ph_id": 4,
        "organic_matter_custom": null,
        "custom_measured_years_ago": 0
      },
      "product_fresh": {
        "value": 1000,
        "unit": "tonne"
      },
      "product_finished": {
        "value": 990,
        "unit": "tonne"
      },
      "residue": {
        "value": null,
        "unit": null,
        "management": "Left distributed on field, OR incorporated, OR mulched"
      },
      "seed_amount": {
        "value": 10,
        "unit": "tonne"
      },
      "irrigation_calculation_type": "volume_depth_distance_irrigation_type"
    },
    "pesticides": [
      {
        "type_id": 1,
        "category_id": 3,
        "percentage_rate": 100,
        "application_rate": {
          "value": 1,
          "unit": "kg / acre"
        }
      }
    ],
    "fertilisers": [
      {
        "type": "Compose your own NPK",
        "production": "Europe 2014",
        "custom_ingredients": {
          "n_total_percentage": 0.0,
          "n_ammonia_percentage": 0.0,
          "n_nitric_percentage": 0.0,
          "n_urea_percentage": 0.0,
          "p2o5_percentage": 0.0,
          "p2o5_percentage_type_id": 4,
          "k2o_percentage": 0.0,
          "k2o_percentage_type_id": 5
        },
        "application_rate": {
          "value": 15,
          "unit": "kg / ha"
        },
        "application_date": "unknown",
        "rate_measure": "product",
        "method": 2,
        "inhibition_id": 1
      }
    ],
    "machinery": [
      {
        "operations": 1,
        "machinery": 24,
        "fuel_type": "diesel (average biofuel blend)"
      }
    ],
    "irrigation": [
      {
        "method": 1,
        "water_source": 1,
        "allocation": 100,
        "pumping_depth": {
          "value": 1,
          "unit": "m"
        },
        "horizontal_distance": {
          "value": 2,
          "unit": "km"
        },
        "water_added": {
          "value": 2,
          "unit": "ha-mm"
        },
        "power_source": 1
      }
    ],
    "direct_energy": [
      {
        "category": "irrigation",
        "source": "diesel (average biofuel blend)",
        "usage": {
          "value": 1000,
          "unit": "litre"
        }
      }
    ],
    "land_management": {
      "carbon_changes": [
        {
          "year_of_change": 2021,
          "allocation": 100,
          "land_use": {
            "from": "cultivated",
            "to": "set-aside"
          },
          "tillage": {
            "from": "reduced",
            "to": "no-till"
          },
          "inputs": {
            "from": "low-c-input",
            "to": "high-c-input-with-manure"
          }
        },
        {
          "year_of_change": 2020,
          "allocation": 44,
          "land_use": {
            "from": "native-forest",
            "to": "cultivated"
          },
          "tillage": {
            "from": "full",
            "to": "reduced"
          },
          "inputs": {
            "from": "high-c-input-without-manure",
            "to": "low-c-input"
          }
        },
        {
          "year_of_change": 2019,
          "allocation": 100,
          "land_use": {
            "from": "native-forest",
            "to": "native-forest"
          },
          "tillage": {
            "from": "reduced",
            "to": "full"
          },
          "inputs": {
            "from": "high-c-input-with-manure",
            "to": "high-c-input-without-manure"
          }
        },
        {
          "year_of_change": 2017,
          "allocation": 29,
          "land_use": {
            "from": "native-forest",
            "to": "native-forest"
          },
          "tillage": {
            "from": "no-till",
            "to": "reduced"
          },
          "inputs": {
            "from": "medium-c-input",
            "to": "high-c-input-with-manure"
          }
        }
      ],
      "forest_biomass": {
        "age_years": 5,
        "type": "boreal mountain system"
      }
    },
    "transport": [
      {
        "mode": "road LGV diesel (light goods vehicle <3.5t)",
        "weight": {
          "value": 4,
          "unit": "tonne"
        },
        "distance": {
          "value": 2000,
          "unit": "km"
        }
      }
    ],
    "tree_biomass": [
      {
        "tree_type": 5,
        "density_last_year": {
          "value": 100,
          "unit": "trees / hectare"
        },
        "size_last_year": {
          "value": 10,
          "unit": "cm"
        },
        "size_this_year": {
          "value": 15,
          "unit": "cm"
        },
        "num_trees_delta": {
          "value": 1,
          "unit": "trees / hectare"
        }
      }
    ],
    "co_products": [
      {
        "name": "test_co_product",
        "percentage_main_value": 50
      }
    ],
    "processing": [
      {
        "_type": 1,
        "allocation": 100,
        "power_source": 102
      }
    ],
    "storage": [
      {
        "cipc_application": 1,
        "cipc_dose": 1,
        "storage_power_source": 106,
        "store_loading_power_source": 102,
        "unloading_power_source": 102,
        "stored_allocation": 100,
        "temperature": {
          "unit": "°C",
          "value": 5
        },
        "time": {
          "unit": 46,
          "value": 1
        }
      }
    ],
    "waste_water": {
      "waste_water_production": {
        "unit": 15,
        "value": 12
      },
      "oxygen_demand": {
        "unit": 18,
        "value": 15
      },
      "oxygen_demand_type": 1,
      "water_treatment_type": 1
    }
  },
  {
    "information": {
      "cft_version": "API_DEMO_TOOL"
    }
  }
]

Example response

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "status": "success",
    "crop_product_uri": "https://app.coolfarmtool.org/crop_product/ABC123/",
    "crop_product_slug": "ABC123"
  }
]
Request Headers
Status Codes
POST /farms/(str: farm_slug)/crop_products/

Create a crop product for a given farm slug and save it to the database

Example request

POST /farms/(str:farm_slug)/crop_products/ HTTP/1.1
Host: app.coolfarmtool.org
Accept: application/json
Content-Type: application/json
[
  {
    "farm": {
      "country": "United States of America",
      "territory": "Alabama",
      "climate": "Warm Temperate Dry",
      "average_temperature": {
        "value": 15,
        "unit": "°C"
      },
      "soil_characteristics": "Sandy Soils",
      "farm_identifier": "",
      "latitude": 32.318,
      "longitude": -86.902
    },
    "crop": {
      "type": "Potato",
      "harvesting_year": 2022,
      "feed_type": null,
      "field_size": {
        "value": 100,
        "unit": "ha"
      },
      "soil": {
        "texture_id": 1,
        "organic_matter_id": 2,
        "drainage_id": 1,
        "ph_id": 4,
        "organic_matter_custom": null,
        "custom_measured_years_ago": 0
      },
      "product_fresh": {
        "value": 1000,
        "unit": "tonne"
      },
      "product_finished": {
        "value": 990,
        "unit": "tonne"
      },
      "residue": {
        "value": null,
        "unit": null,
        "management": "Left distributed on field, OR incorporated, OR mulched"
      },
      "seed_amount": {
        "value": 10,
        "unit": "tonne"
      },
      "irrigation_calculation_type": "volume_depth_distance_irrigation_type"
    },
    "pesticides": [
      {
        "type_id": 1,
        "category_id": 3,
        "percentage_rate": 100,
        "application_rate": {
          "value": 1,
          "unit": "kg / acre"
        }
      }
    ],
    "fertilisers": [
      {
        "type": "Compose your own NPK",
        "production": "Europe 2014",
        "custom_ingredients": {
          "n_total_percentage": 0.0,
          "n_ammonia_percentage": 0.0,
          "n_nitric_percentage": 0.0,
          "n_urea_percentage": 0.0,
          "p2o5_percentage": 0.0,
          "p2o5_percentage_type_id": 4,
          "k2o_percentage": 0.0,
          "k2o_percentage_type_id": 5
        },
        "application_rate": {
          "value": 15,
          "unit": "kg / ha"
        },
        "application_date": "unknown",
        "rate_measure": "product",
        "method": 2,
        "inhibition_id": 1
      }
    ],
    "machinery": [
      {
        "operations": 1,
        "machinery": 24,
        "fuel_type": "diesel (average biofuel blend)"
      }
    ],
    "irrigation": [
      {
        "method": 1,
        "water_source": 1,
        "allocation": 100,
        "pumping_depth": {
          "value": 1,
          "unit": "m"
        },
        "horizontal_distance": {
          "value": 2,
          "unit": "km"
        },
        "water_added": {
          "value": 2,
          "unit": "ha-mm"
        },
        "power_source": 1
      }
    ],
    "direct_energy": [
      {
        "category": "irrigation",
        "source": "diesel (average biofuel blend)",
        "usage": {
          "value": 1000,
          "unit": "litre"
        }
      }
    ],
    "land_management": {
      "carbon_changes": [
        {
          "year_of_change": 2021,
          "allocation": 100,
          "land_use": {
            "from": "cultivated",
            "to": "set-aside"
          },
          "tillage": {
            "from": "reduced",
            "to": "no-till"
          },
          "inputs": {
            "from": "low-c-input",
            "to": "high-c-input-with-manure"
          }
        },
        {
          "year_of_change": 2020,
          "allocation": 44,
          "land_use": {
            "from": "native-forest",
            "to": "cultivated"
          },
          "tillage": {
            "from": "full",
            "to": "reduced"
          },
          "inputs": {
            "from": "high-c-input-without-manure",
            "to": "low-c-input"
          }
        },
        {
          "year_of_change": 2019,
          "allocation": 100,
          "land_use": {
            "from": "native-forest",
            "to": "native-forest"
          },
          "tillage": {
            "from": "reduced",
            "to": "full"
          },
          "inputs": {
            "from": "high-c-input-with-manure",
            "to": "high-c-input-without-manure"
          }
        },
        {
          "year_of_change": 2017,
          "allocation": 29,
          "land_use": {
            "from": "native-forest",
            "to": "native-forest"
          },
          "tillage": {
            "from": "no-till",
            "to": "reduced"
          },
          "inputs": {
            "from": "medium-c-input",
            "to": "high-c-input-with-manure"
          }
        }
      ],
      "forest_biomass": {
        "age_years": 5,
        "type": "boreal mountain system"
      }
    },
    "transport": [
      {
        "mode": "road LGV diesel (light goods vehicle <3.5t)",
        "weight": {
          "value": 4,
          "unit": "tonne"
        },
        "distance": {
          "value": 2000,
          "unit": "km"
        }
      }
    ],
    "tree_biomass": [
      {
        "tree_type": 5,
        "density_last_year": {
          "value": 100,
          "unit": "trees / hectare"
        },
        "size_last_year": {
          "value": 10,
          "unit": "cm"
        },
        "size_this_year": {
          "value": 15,
          "unit": "cm"
        },
        "num_trees_delta": {
          "value": 1,
          "unit": "trees / hectare"
        }
      }
    ],
    "co_products": [
      {
        "name": "test_co_product",
        "percentage_main_value": 50
      }
    ],
    "processing": [
      {
        "_type": 1,
        "allocation": 100,
        "power_source": 102
      }
    ],
    "storage": [
      {
        "cipc_application": 1,
        "cipc_dose": 1,
        "storage_power_source": 106,
        "store_loading_power_source": 102,
        "unloading_power_source": 102,
        "stored_allocation": 100,
        "temperature": {
          "unit": "°C",
          "value": 5
        },
        "time": {
          "unit": 46,
          "value": 1
        }
      }
    ],
    "waste_water": {
      "waste_water_production": {
        "unit": 15,
        "value": 12
      },
      "oxygen_demand": {
        "unit": 18,
        "value": 15
      },
      "oxygen_demand_type": 1,
      "water_treatment_type": 1
    }
  },
  {
    "information": {
      "cft_version": "API_DEMO_TOOL"
    }
  }
]

Example response

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "status": "success",
    "crop_product_uri": "https://app.coolfarmtool.org/crop_product/ABC123/",
    "crop_product_slug": "ABC123"
  }
]
Request Headers
Status Codes

Crop type Rice

Note

When creating a rice crop product please note two additional fields: Flooding is a required parameter but optional to provide (if not provided a default value will be used). The time under cultivation may be entered directly in number of days. If it is not provided the IPCC 2019 default number of days based on farm location and region will be applied. Green manure is an optional parameter and may be provided as shown below

"flooding": {
     "time_under_cultivation": {
         "value": 123,
         "unit": "d"
     },
 "before_cultivation": "Not flooded pre-season (for < 180 days)",
 "during_cultivation": "Continuously flooded"
 },
 "green_manure": {
     "amount": {
         "value": 6.6,
         "unit": "tonne / ha"
     }
 }
POST /crop_product/

Create a rice crop product and save it to the database

Example request

POST /crop_product/ HTTP/1.1
Host: app.coolfarmtool.org
Accept: application/json
Content-Type: application/json
[
  {
    "farm": {
      "country": "United Kingdom",
      "territory": null,
      "climate": "Warm Temperate Dry",
      "average_temperature": {
        "value": 16,
        "unit": "\u00b0C"
      },
      "farm_identifier": "",
      "soil_characteristics": "Sandy Soils",
      "latitude": 52.164,
      "longitude": 1.435
    },
    "crop": {
      "type": "Rice",
      "harvesting_year": 2022,
      "feed_type": null,
      "field_size": {
        "value": 10,
        "unit": 10
      },
      "soil": {
        "texture_id": 2,
        "organic_matter_id": 2,
        "drainage_id": 1,
        "ph_id": 1,
        "organic_matter_custom": null,
        "custom_measured_years_ago": 0
      },
      "product_fresh": {
        "value": 10000,
        "unit": "kg"
      },
      "product_finished": {
        "value": 10000,
        "unit": "kg"
      },
      "residue": {
        "value": 4.55,
        "unit": "tonne / ha",
        "management": "Rice straw incorporation less than 30 days before cultivation"
      },
      "seed_amount": {
        "value": 0,
        "unit": ""
      },
      "irrigation_calculation_type": 1
    },
    "pesticides": [],
    "fertilisers": [],
    "machinery": [],
    "irrigation": [],
    "direct_energy": [],
    "land_management": {
      "carbon_changes": [
        {
          "year_of_change": 2022,
          "allocation": 100,
          "land_use": {
            "from": "cultivated",
            "to": "set-aside"
          },
          "tillage": {
            "from": "full",
            "to": "full"
          },
          "inputs": {
            "from": "low-c-input",
            "to": "low-c-input"
          }
        },
        {
          "year_of_change": 2020,
          "allocation": 44,
          "land_use": {
            "from": "native-forest",
            "to": "cultivated"
          },
          "tillage": {
            "from": "full",
            "to": "full"
          },
          "inputs": {
            "from": "low-c-input",
            "to": "low-c-input"
          }
        },
        {
          "year_of_change": 2019,
          "allocation": 100,
          "land_use": {
            "from": "native-forest",
            "to": "native-forest"
          },
          "tillage": {
            "from": "full",
            "to": "full"
          },
          "inputs": {
            "from": "low-c-input",
            "to": "low-c-input"
          }
        },
        {
          "year_of_change": 2017,
          "allocation": 29,
          "land_use": {
            "from": "native-forest",
            "to": "native-forest"
          },
          "tillage": {
            "from": "full",
            "to": "full"
          },
          "inputs": {
            "from": "low-c-input",
            "to": "low-c-input"
          }
        }
      ],
      "forest_biomass": {
        "age_years": 5,
        "type": "boreal mountain system"
      }
    },
    "transport": [],
    "tree_biomass": [],
    "co_products": [],
    "processing": [],
    "storage": [],
    "flooding": {
      "time_under_cultivation": {
        "value": 123,
        "unit": "day"
      },
      "before_cultivation": "Not flooded pre-season (for < 180 days)",
      "during_cultivation": "Continuously flooded"
    },
    "green_manure": {
      "amount": {
        "value": 6.6,
        "unit": "tonne / ha"
      }
    }
  }
]

Example response

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "status": "success",
    "crop_product_uri": "https://app.coolfarmtool.org/crop_product/ABC123/",
    "crop_product_slug": "ABC123"
  }
]
Request Headers
Status Codes

Dairy assessment

Note

When saving a dairy product to the database which uses a crop product as a feed item, you will need to create an existing crop product, either in the user interface or the API as specified in the Crop assessment section of this documentation. When sending a request to the /dairy_product/ endpoint, include the crop product as one of the feed components, as demonstrated below.

{
    "herd_section": "Dairy calves",
    "crop_product": {
        "type": "Soyabean",
        "slug": null, // Add the slug of your crop product here
        "product_dry": {
            "value": 5,
            "unit": "tonne"
        },
        "feed_type": "Soybean",
        "emissions_total": {
            "value": 22469.393582158074,
            "unit": "kg CO2e"
        }
    },
    "dry_matter": {
              "value": 8,
              "unit": "kg"
            },
            "certified": false
}
POST /dairy_product/

Create a dairy product and save it to the database

Example request

POST /dairy_product/calculate/ HTTP/1.1
Host: app.coolfarmtool.org
Accept: application/json
Content-Type: application/json
[
  {
    "farm": {
      "country": 840,
      "territory": "Wisconsin",
      "climate": "Warm Temperate Dry",
      "average_temperature": {
        "value": 15,
        "unit": "°C"
      },
      "soil_characteristics": "Sandy Soils",
      "farm_identifier": "",
      "latitude": 43.784,
      "longitude": -88.788
    },
    "general": {
      "grazing_area": {
        "value": 50,
        "unit": "ha"
      },
      "feed_approach": "dmi",
      "fertilisation_approach": 1
    },
    "milk_production": {
      "variety": "Normande",
      "reporting_year": 2019,
      "date_time": "start",
      "date_month": 1,
      "name": "normande_2019",
      "product_dry": {
        "value": 500000,
        "unit": "litre"
      },
      "fat_content": 4.2,
      "protein_content": 3.5,
      "protein_measure": 1
    },
    "herd_sections": [
      {
        "phase": "Dairy calves",
        "animals": 40,
        "live_weight": {
          "value": 166,
          "unit": "kg"
        },
        "sold_animals": 15,
        "sold_weight": {
          "value": 166,
          "unit": "kg"
        },
        "purchased_animals": 10,
        "purchased_weight": {
          "value": 166,
          "unit": "kg"
        }
      },
      {
        "phase": "Meat calves",
        "animals": 30,
        "live_weight": {
          "value": 230,
          "unit": "kg"
        },
        "sold_animals": 10,
        "sold_weight": {
          "value": 230,
          "unit": "kg"
        },
        "purchased_animals": 5,
        "purchased_weight": {
          "value": 230,
          "unit": "kg"
        }
      },
      {
        "phase": "Milk cows",
        "animals": 100,
        "live_weight": {
          "value": 555,
          "unit": "kg"
        },
        "sold_animals": 5,
        "sold_weight": {
          "value": 555,
          "unit": "kg"
        },
        "purchased_animals": 0,
        "purchased_weight": {
          "value": 555,
          "unit": "kg"
        }
      }
    ],
    "grazing": [
      {
        "herd_section": "Dairy calves",
        "days": 100,
        "hours": 12,
        "category": 2,
        "quality": 1
      },
      {
        "herd_section": "Meat calves",
        "days": 100,
        "hours": 12,
        "category": 3,
        "quality": 2
      },
      {
        "herd_section": "Milk cows",
        "days": 150,
        "hours": 12,
        "category": 2,
        "quality": 1
      }
    ],
    "fertilisers": [
      {
        "type": "Ammonium nitrate - 33.5% N (prilled)",
        "production": "Europe 2014",
        "custom_ingredients": {},
        "application_rate": {
          "value": 30,
          "unit": "kg / ha"
        },
        "application_date": "unknown",
        "rate_measure": "",
        "inhibition": 1
      },
      {
        "type": "Compose your own NPK",
        "production": "Europe 2014",
        "custom_ingredients": {
          "n_ammonia_percentage": 6,
          "n_total_percentage": 12,
          "n_nitric_percentage": 4,
          "n_urea_percentage": 2,
          "p2o5_percentage": 8,
          "p2o5_percentage_type_id": 4,
          "k2o_percentage": 4,
          "k2o_percentage_type_id": 5
        },
        "application_rate": {
          "value": 20,
          "unit": "kg / ha"
        },
        "application_date": "unknown",
        "rate_measure": "",
        "inhibition": 1
      }
    ],
    "feed_components": [
      {
        "herd_section": "Dairy calves",
        "item": "Grass fresh managed - on farm",
        "region": "Global (world)",
        "dry_matter": {
          "value": 0.41,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Dairy calves",
        "item": "Maize / corn grain",
        "region": "Global (world)",
        "dry_matter": {
          "value": 10,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Dairy calves",
        "item": "Oats",
        "region": "Global (world)",
        "dry_matter": {
          "value": 4,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Dairy calves",
        "item": "Compound dairy feed: Belgium (65% soy)",
        "region": "Global (world)",
        "dry_matter": {
          "value": 5,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Meat calves",
        "item": "Grass fresh managed - on farm",
        "region": "Global (world)",
        "dry_matter": {
          "value": 0.62,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Meat calves",
        "item": "Maize / corn grain",
        "region": "Global (world)",
        "dry_matter": {
          "value": 5,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Meat calves",
        "item": "Soybean cake/meal",
        "region": "Global (world)",
        "dry_matter": {
          "value": 5,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Milk cows",
        "item": "Straw",
        "region": "Global (world)",
        "dry_matter": {
          "value": 10,
          "unit": "kg"
        },
        "certified": false
      }
    ],
    "feed_additives": [
      {
       "herd_section": "Dairy calves",
       "type": "3NOP",
       "dose": 100,
       "dose_unit": "mg / kg",
       "ndf": 40,
       "crude_fat": 5,
       "days": 10,
       "herd_section_percentage": 100
     },
     {
       "herd_section": "Milk cows",
       "type": "Nitrate",
       "dose": 30,
       "dose_unit": "g / kg",
       "days": 10,
       "herd_section_percentage": 100
     }
    ],
    "manure": [
      {
        "herd_section": "Dairy calves",
        "type": "Solid storage",
        "allocation": 100
      },
      {
        "herd_section": "Milk cows",
        "type": "Aerobic treatment - natural aeration",
        "allocation": 100
      }
    ],
    "bedding": [
      {
        "type": 621,
        "quantity": {
          "value": 100,
          "unit": "kg"
        }
      }
    ],
    "direct_energy": [
      {
        "source": "diesel (average biofuel blend)",
        "usage": {
          "value": 1200,
          "unit": "litre"
        },
        "category": 1
      },
      {
        "source": "electricity (grid)",
        "usage": {
          "value": 1000,
          "unit": "kWh"
        },
        "category": 1
      }
    ],
    "transport": [
      {
        "mode": "road LGV diesel (light goods vehicle <3.5t)",
        "weight": {
          "value": 5,
          "unit": "tonne"
        },
        "distance": {
          "value": 3500,
          "unit": "km"
        }
      }
    ]
  },
  {
    "information": {
      "cft_version": "API_DEMO_TOOL"
    }
  }
]

Example response

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "status": "success",
    "dairy_product_uri": "https://app.coolfarmtool.org/dairy_product/ABC123",
    "dairy_product_slug": "ABC123"
  }
]
Request Headers
Status Codes
POST /farms/(str: farm_slug)/dairy_products/

Create a dairy product for a given farm slug and save it to the database

Example request

POST /farms/(str:farm_slug)/dairy_products/ HTTP/1.1
Host: app.coolfarmtool.org
Accept: application/json
Content-Type: application/json
[
  {
    "farm": {
      "country": 840,
      "territory": "Wisconsin",
      "climate": "Warm Temperate Dry",
      "average_temperature": {
        "value": 15,
        "unit": "°C"
      },
      "soil_characteristics": "Sandy Soils",
      "farm_identifier": "",
      "latitude": 43.784,
      "longitude": -88.788
    },
    "general": {
      "grazing_area": {
        "value": 50,
        "unit": "ha"
      },
      "feed_approach": "dmi",
      "fertilisation_approach": 1
    },
    "milk_production": {
      "variety": "Normande",
      "reporting_year": 2019,
      "date_time": "start",
      "date_month": 1,
      "name": "normande_2019",
      "product_dry": {
        "value": 500000,
        "unit": "litre"
      },
      "fat_content": 4.2,
      "protein_content": 3.5,
      "protein_measure": 1
    },
    "herd_sections": [
      {
        "phase": "Dairy calves",
        "animals": 40,
        "live_weight": {
          "value": 166,
          "unit": "kg"
        },
        "sold_animals": 15,
        "sold_weight": {
          "value": 166,
          "unit": "kg"
        },
        "purchased_animals": 10,
        "purchased_weight": {
          "value": 166,
          "unit": "kg"
        }
      },
      {
        "phase": "Meat calves",
        "animals": 30,
        "live_weight": {
          "value": 230,
          "unit": "kg"
        },
        "sold_animals": 10,
        "sold_weight": {
          "value": 230,
          "unit": "kg"
        },
        "purchased_animals": 5,
        "purchased_weight": {
          "value": 230,
          "unit": "kg"
        }
      },
      {
        "phase": "Milk cows",
        "animals": 100,
        "live_weight": {
          "value": 555,
          "unit": "kg"
        },
        "sold_animals": 5,
        "sold_weight": {
          "value": 555,
          "unit": "kg"
        },
        "purchased_animals": 0,
        "purchased_weight": {
          "value": 555,
          "unit": "kg"
        }
      }
    ],
    "grazing": [
      {
        "herd_section": "Dairy calves",
        "days": 100,
        "hours": 12,
        "category": 2,
        "quality": 1
      },
      {
        "herd_section": "Meat calves",
        "days": 100,
        "hours": 12,
        "category": 3,
        "quality": 2
      },
      {
        "herd_section": "Milk cows",
        "days": 150,
        "hours": 12,
        "category": 2,
        "quality": 1
      }
    ],
    "fertilisers": [
      {
        "type": "Ammonium nitrate - 33.5% N (prilled)",
        "production": "Europe 2014",
        "custom_ingredients": {},
        "application_rate": {
          "value": 30,
          "unit": "kg / ha"
        },
        "application_date": "unknown",
        "rate_measure": "",
        "inhibition": 1
      },
      {
        "type": "Compose your own NPK",
        "production": "Europe 2014",
        "custom_ingredients": {
          "n_ammonia_percentage": 6,
          "n_total_percentage": 12,
          "n_nitric_percentage": 4,
          "n_urea_percentage": 2,
          "p2o5_percentage": 8,
          "p2o5_percentage_type_id": 4,
          "k2o_percentage": 4,
          "k2o_percentage_type_id": 5
        },
        "application_rate": {
          "value": 20,
          "unit": "kg / ha"
        },
        "application_date": "unknown",
        "rate_measure": "",
        "inhibition": 1
      }
    ],
    "feed_components": [
      {
        "herd_section": "Dairy calves",
        "item": "Grass fresh managed - on farm",
        "region": "Global (world)",
        "dry_matter": {
          "value": 0.41,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Dairy calves",
        "item": "Maize / corn grain",
        "region": "Global (world)",
        "dry_matter": {
          "value": 10,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Dairy calves",
        "item": "Oats",
        "region": "Global (world)",
        "dry_matter": {
          "value": 4,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Dairy calves",
        "item": "Compound dairy feed: Belgium (65% soy)",
        "region": "Global (world)",
        "dry_matter": {
          "value": 5,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Meat calves",
        "item": "Grass fresh managed - on farm",
        "region": "Global (world)",
        "dry_matter": {
          "value": 0.62,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Meat calves",
        "item": "Maize / corn grain",
        "region": "Global (world)",
        "dry_matter": {
          "value": 5,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Meat calves",
        "item": "Soybean cake/meal",
        "region": "Global (world)",
        "dry_matter": {
          "value": 5,
          "unit": "kg"
        },
        "certified": false
      },
      {
        "herd_section": "Milk cows",
        "item": "Straw",
        "region": "Global (world)",
        "dry_matter": {
          "value": 10,
          "unit": "kg"
        },
        "certified": false
      }
    ],
    "feed_additives": [
      {
       "herd_section": "Dairy calves",
       "type": "3NOP",
       "dose": 100,
       "dose_unit": "mg / kg",
       "ndf": 40,
       "crude_fat": 5,
       "days": 10,
       "herd_section_percentage": 100
     },
     {
       "herd_section": "Milk cows",
       "type": "Nitrate",
       "dose": 30,
       "dose_unit": "g / kg",
       "days": 10,
       "herd_section_percentage": 100
     }
    ],
    "manure": [
      {
        "herd_section": "Dairy calves",
        "type": "Solid storage",
        "allocation": 100
      },
      {
        "herd_section": "Milk cows",
        "type": "Aerobic treatment - natural aeration",
        "allocation": 100
      }
    ],
    "bedding": [
      {
        "type": 621,
        "quantity": {
          "value": 100,
          "unit": "kg"
        }
      }
    ],
    "direct_energy": [
      {
        "source": "diesel (average biofuel blend)",
        "usage": {
          "value": 1200,
          "unit": "litre"
        },
        "category": 1
      },
      {
        "source": "electricity (grid)",
        "usage": {
          "value": 1000,
          "unit": "kWh"
        },
        "category": 1
      }
    ],
    "transport": [
      {
        "mode": "road LGV diesel (light goods vehicle <3.5t)",
        "weight": {
          "value": 5,
          "unit": "tonne"
        },
        "distance": {
          "value": 3500,
          "unit": "km"
        }
      }
    ]
  },
  {
    "information": {
      "cft_version": "API_DEMO_TOOL"
    }
  }
]

Example response

HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "status": "success",
    "dairy_product_uri": "https://app.coolfarmtool.org/dairy_product/ABC123",
    "dairy_product_slug": "ABC123"
  }
]
Request Headers
Status Codes