API to change Data Retention period of Immutable device

Hi,

I could not able to find the methods which allow to edit the data retention period of device in Resources.devices.As we cannot use account.buckets, it would be great if you indicate me the API which allow us to perform this functionality.

Thank you

Hello hegde.ramyanarayan,

Regarding your question, it is indeed possible to edit the retention chunk, but the period chunk cannot be edited.

To update the retention, you can use the Resources.devices.edit() method. Below is an example of how to use it. Please ensure that you have the appropriate permissions set in Access Management.

const { Analysis, Resources } = require(“@tago-io/sdk”);

async function startAnalysis() {

const [fetchDevice] = await Resources.devices.list({

amount: 1,

fields: [“id”, “name”],

filter: { tags: [{ key: “device_type”, value: “device” }] }

});

if (!fetchDevice) {

throw new Error(“Device not found”);

}

await Resources.devices.edit(fetchDevice.id, { chunk_retention: 6 });

console.info(“Finished”);

}

Thank you Mateus. It worked