Request
POST https://backend.net0.com/v1/products/{productId}/materials
This endpoint allows you to add a material or a process to a product, which will be used to calculate the emission profile of a given product or SKU.
curl --location --request POST 'https://backend.net0.com/v1/products/2/materials' \
--header 'x-api-key: <API_KEY>' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 2,
"name": "TEST Material",
"totalEmission": 0,
"materialType": "Material"
}'
Request Body
{
"id": 0,
"name": "string",
"totalEmission": 0,
"materialType": "Material"
}
The following parameters can be defined as a JSON-encoded body.
Attribute | Type | Description | Required | In |
---|---|---|---|---|
productId | String | The Id of the product to create a material for. | true | Path |
name | String | The name of the material OR process to be added to the product. | true | Body |
totalEmission | Number | Describes the total emission which the product material emits. | true | Body |
MaterialType | String | Type of entry: Material or Product. | true | Body |
id | number | This is the id of the product for which this new material or process is been added. | true | Body |
Response
The response includes an object containing the created material for the product.
{
"id": 1,
"name": "TEST Material",
"materialType": "Material",
"createdAt": "2021-11-25T21:14:50.336Z",
"updatedAt": "2021-11-25T21:14:50.336Z",
"totalEmission": 0,
"companyId": 2,
"materialsProduct": [
{
"productId": 2,
"materialId": 1,
"totalEmission": null,
"createdAt": "2021-11-25T21:14:50.346Z",
"updatedAt": "2021-11-25T21:14:50.346Z"
}
]
}