Back to Content Management API
templateDeleteBulk
Deletes several templates in a background job. Content that used a deleted template switches to that template's translation in its locale, or to your default template. The default template can't be deleted.
Each template is deleted on its own, so one failure doesn't stop the others. Fails while a content release is selected (X-Pack-Release-Id); create content outside the release.
Arguments
- Name
ids- Type
- [ID!]!
- Description
The IDs of the templates to delete.
Returns
- Name
Job- Type
- Job
- Description
The
idof the background job. There's no query to check a job's status; the change appears once the job finishes.
Request
import { PackClient } from '@pack/client'
const packClient = new PackClient({
token: 'YOUR-PACK-SECRET-TOKEN'
});
const query = `
mutation TemplateDeleteBulk($ids: [ID!]!) {
templateDeleteBulk(ids: $ids) {
id
}
}
`;
const variables = {
ids: ['YOUR-TEMPLATE-ID-1', 'YOUR-TEMPLATE-ID-2']
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"templateDeleteBulk": {
"id": "YOUR-JOB-ID"
}
}
}