Hi,
I was trying to delete all records in my sandbox env using this piece of code.
I use the full access token here.
const recordObj=[];
for await (const record of client.items.listPagedIterator({version:"current"})) {
recordObj.push({
type: record.type,
id: record.id
})
}
const result = await client.items.bulkDestroy({
items: recordObj
});
The part of code that retrieves all records gives me all the records from different pages (including my schema migrations) which is exactly what I want but it throws a this error:
body: {
data: [
{
id: 'a6c24d',
type: 'api_error',
attributes: { code: 'TOO_MANY_OPERATIONS', details: {} }
}
]
}
},
There are totally 1720 records so I reduced them to maybe a 100 or 50 in batch but this gives me a 404 now. Further reducing it to 5 worked occasionally for some ids, for some it still threw a 404 even though it was existing. Based on what I see, bulkDestroy does not identify records belonging to different pages/models when given at once. Is this expected?
Also the reason I am doing this is because I want a sandbox env without any data where I can test my backup/restore scripts. Is there possibly a better way to do this, like a fork a env without any data?