Add new material/process to the Product

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.

AttributeTypeDescriptionRequiredIn
productIdStringThe Id of the product to create a material for.truePath
nameStringThe name of the material OR process to be added to the product.trueBody
totalEmissionNumberDescribes the total emission which the product material emits.trueBody
MaterialTypeStringType of entry: Material or Product.trueBody
idnumberThis is the id of the product for which this new material or process is been added.trueBody

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"
        }
    ]
}