In this example, we will update the parameters after a bulk upload
- got an update from Bulk upload
- use entityId from the response and fetch entity data by the entityId
const myHeaders = new Headers();
myHeaders.append("x-token", token);
myHeaders.append("x-lang", "uk");
const requestOptions = {
method: "GET",
headers: myHeaders,
};
const {data: entityData} = await fetch("https://example.com/api/entities/3265", requestOptions)
.then((response) => response.json())
.catch((error) => console.error(error));
- update data
const myHeaders3 = new Headers();
myHeaders3.append("x-token", token);
myHeaders3.append("Content-Type", "application/json");
const geometries = entityData.geometries;
entityData.geometries[0].position = 1;
entityData.geometries[1].position = 0;
entityData.geometries[2].source = 'none';
entityData.geometries[2].materialId = 12345;
const raw = JSON.stringify(entityData);
const requestOptions3 = {
method: "PUT",
headers: myHeaders3,
body: raw,
};
fetch("https://example.com/api/entities/3265", requestOptions3)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
In this example, the order of geometries 0 and 1 is swapped. Also, the source of geometry at index 2 changed to fixed (none) and the default material was changed to 12345