curl --request PUT \
--url https://api.emidat.com/v2/prechain-products/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"external_id": "PRECHAIN-CLINKER-001",
"product_instance_id": "44444444-4444-4444-4444-444444444444",
"plant_id": "11111111-1111-1111-1111-111111111111",
"transport_route": {
"truck_distance_km": 150
}
}
'import requests
url = "https://api.emidat.com/v2/prechain-products/{id}"
payload = {
"external_id": "PRECHAIN-CLINKER-001",
"product_instance_id": "44444444-4444-4444-4444-444444444444",
"plant_id": "11111111-1111-1111-1111-111111111111",
"transport_route": { "truck_distance_km": 150 }
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
external_id: 'PRECHAIN-CLINKER-001',
product_instance_id: '44444444-4444-4444-4444-444444444444',
plant_id: '11111111-1111-1111-1111-111111111111',
transport_route: {truck_distance_km: 150}
})
};
fetch('https://api.emidat.com/v2/prechain-products/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.emidat.com/v2/prechain-products/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'external_id' => 'PRECHAIN-CLINKER-001',
'product_instance_id' => '44444444-4444-4444-4444-444444444444',
'plant_id' => '11111111-1111-1111-1111-111111111111',
'transport_route' => [
'truck_distance_km' => 150
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.emidat.com/v2/prechain-products/{id}"
payload := strings.NewReader("{\n \"external_id\": \"PRECHAIN-CLINKER-001\",\n \"product_instance_id\": \"44444444-4444-4444-4444-444444444444\",\n \"plant_id\": \"11111111-1111-1111-1111-111111111111\",\n \"transport_route\": {\n \"truck_distance_km\": 150\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.emidat.com/v2/prechain-products/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"external_id\": \"PRECHAIN-CLINKER-001\",\n \"product_instance_id\": \"44444444-4444-4444-4444-444444444444\",\n \"plant_id\": \"11111111-1111-1111-1111-111111111111\",\n \"transport_route\": {\n \"truck_distance_km\": 150\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.emidat.com/v2/prechain-products/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_id\": \"PRECHAIN-CLINKER-001\",\n \"product_instance_id\": \"44444444-4444-4444-4444-444444444444\",\n \"plant_id\": \"11111111-1111-1111-1111-111111111111\",\n \"transport_route\": {\n \"truck_distance_km\": 150\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"product_instance_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"transport_route": {
"truck_distance_km": 123,
"train_distance_km": 123,
"ship_distance_km": 123
},
"impacts_per_kg": [
{
"indicator_name": "GWP-total",
"unit": "kg CO2-Eq",
"value": -1.7838794215158404
}
],
"transport_impacts_per_kg": [
{
"indicator_name": "GWP-total",
"unit": "kg CO2-Eq",
"value": -1.7838794215158404
}
]
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
}
}Update prechain product
Full replacement of editable fields. Send external_id and
transport_route; immutable references may be omitted or echoed from the
current resource, but cannot be changed. Returns the prechain product with
recomputed per-kg impacts.
curl --request PUT \
--url https://api.emidat.com/v2/prechain-products/{id} \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"external_id": "PRECHAIN-CLINKER-001",
"product_instance_id": "44444444-4444-4444-4444-444444444444",
"plant_id": "11111111-1111-1111-1111-111111111111",
"transport_route": {
"truck_distance_km": 150
}
}
'import requests
url = "https://api.emidat.com/v2/prechain-products/{id}"
payload = {
"external_id": "PRECHAIN-CLINKER-001",
"product_instance_id": "44444444-4444-4444-4444-444444444444",
"plant_id": "11111111-1111-1111-1111-111111111111",
"transport_route": { "truck_distance_km": 150 }
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
external_id: 'PRECHAIN-CLINKER-001',
product_instance_id: '44444444-4444-4444-4444-444444444444',
plant_id: '11111111-1111-1111-1111-111111111111',
transport_route: {truck_distance_km: 150}
})
};
fetch('https://api.emidat.com/v2/prechain-products/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.emidat.com/v2/prechain-products/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'external_id' => 'PRECHAIN-CLINKER-001',
'product_instance_id' => '44444444-4444-4444-4444-444444444444',
'plant_id' => '11111111-1111-1111-1111-111111111111',
'transport_route' => [
'truck_distance_km' => 150
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.emidat.com/v2/prechain-products/{id}"
payload := strings.NewReader("{\n \"external_id\": \"PRECHAIN-CLINKER-001\",\n \"product_instance_id\": \"44444444-4444-4444-4444-444444444444\",\n \"plant_id\": \"11111111-1111-1111-1111-111111111111\",\n \"transport_route\": {\n \"truck_distance_km\": 150\n }\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://api.emidat.com/v2/prechain-products/{id}")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"external_id\": \"PRECHAIN-CLINKER-001\",\n \"product_instance_id\": \"44444444-4444-4444-4444-444444444444\",\n \"plant_id\": \"11111111-1111-1111-1111-111111111111\",\n \"transport_route\": {\n \"truck_distance_km\": 150\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.emidat.com/v2/prechain-products/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"external_id\": \"PRECHAIN-CLINKER-001\",\n \"product_instance_id\": \"44444444-4444-4444-4444-444444444444\",\n \"plant_id\": \"11111111-1111-1111-1111-111111111111\",\n \"transport_route\": {\n \"truck_distance_km\": 150\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"external_id": "<string>",
"product_instance_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"plant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"transport_route": {
"truck_distance_km": 123,
"train_distance_km": 123,
"ship_distance_km": 123
},
"impacts_per_kg": [
{
"indicator_name": "GWP-total",
"unit": "kg CO2-Eq",
"value": -1.7838794215158404
}
],
"transport_impacts_per_kg": [
{
"indicator_name": "GWP-total",
"unit": "kg CO2-Eq",
"value": -1.7838794215158404
}
]
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
}
}{
"msg": "supplier product requires a supplier plant",
"err_code": "err_supplier_product_missing_supplier_plant",
"entitlement_limit": {
"dimension": "users",
"usage": 123,
"limit": 123
}
}Authorizations
Per-manufacturer API key in the X-API-Key header, format
emidat-{key_id}-{secret} where key_id is a random public handle.
Issued by an owner in the Emidat
dashboard; carries its own permission scopes, optional plant
restrictions, and optional expiry. A revoked, expired, or unknown key
returns 401. See the Authentication guide for details.
Path Parameters
UUID of the prechain product to update.
Body
Full replacement of editable fields. external_id and transport_route
are required and overwrite the stored values. The immutable identity
fields may be omitted or echoed from the current resource.
Your own code for this prechain product. Send the code you want or
the one it already carries; null clears it.
Replaces the transport route (distances per modality, km).
Show child attributes
Show child attributes
Optional assertion of the resource ID. It must match the path id.
Optional assertion of the current upstream product instance. A
different value returns 422.
Optional assertion of the current consuming plant. A different value
returns 422.
Response
Updated prechain product.
An existing product instance used as an upstream ("prechain") input at one of your plants, with an optional transport route and its per-kg impacts.
Your own code for this prechain product, or null if none.
UUID of the product instance used as the input.
UUID of the consuming plant.
Transport distances to the consuming plant, one per modality (km).
Show child attributes
Show child attributes
Characterized impacts of the input per kg. Null until computed.
Show child attributes
Show child attributes
Transport-only impacts per kg. Null until computed.
Show child attributes
Show child attributes