Both destroy and bulkDestroy are failing with a ApiException: 404 NOT_FOUND (details: {})
without further details.
The setup as per the documentation:
(Using a full access token)
const SiteClient = require('datocms-client').SiteClient;
const client = new SiteClient('supersecrettokenYouSeeNothingHere', { environment: 'development' });
async function main(){
const records = (await client.items.all(
{
filter: {
type: "bad_block_whose_records_need_to_be_deleted",
},
},
{
allPages: true,
}
)).map(r => r.id);
// Test that I can actually retrieve a record
const r = await client.items.find(records[0], {
version: 'published'
});
console.log(r); // It prints out information, it finds the record
// This bulkDestroy does not work and dies with 404
// await client.items.bulkDestroy({
// items: records
// });
//This also doesn't work with just a single record, dies with same error
client.items.destroy(records[0]).catch(e => console.error(e));
}
main();
Not sure what I could be doing wrong? datocms-client used is 3.4.7 .
Any ideas?