API for data_retention

The API docs show that Account.buckets.edit takes a Partial<BucketCreateInfo>, but data_retention and data_retention_ignore are only available from the <BucketInfo> interface.
Is there a way to update (or set during device creation) the data_retention and data_retention_ignore values for a bucket via the API?

1 Like

Hi @sevils. Actually this is a problem in our documentation, thank you for reporting. These fields can be used on create and edit methods, here is an example:

  • JavaScript
const { Account } = require("@tago-io/sdk");

const acc = new Account({
    token: "YOUR-ACCOUNT-TOKEN",
});

acc.buckets.edit("YOUR-BUCKET-ID", {
    data_retention: "1 day",
    data_retention_ignore: ["temperature"],
});
  • Typescript
import { Account } from "@tago-io/sdk";

const acc = new Account({
    token: "YOUR-ACCOUNT-TOKEN",
});

acc.buckets.edit("YOUR-BUCKET-ID", {
    data_retention: "1 day",
    data_retention_ignore: ["temperature"],
} as any);

Hope this helps!

1 Like

Perfect, thanks @stoklosa, have implemented and working nicely.

1 Like