const url = 'https://api.maalbar.dk/v1/screenings/{screeningPublicId}/materials';
const options = {
method: 'POST',
headers: {'X-Api-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
publicId: 'item_xxxxxxxxxxxx',
label: '<string>',
functionalUnitValue: 0,
designedForDisassembly: false,
productionWaste: 0,
fields: [
{
publicId: {},
locationPublicId: {},
additional: {proportion: 123, recycleShare: 123, materialUnits: {DTex: 123}}
}
]
})
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));