Back to Content Management API
schedulePublishUnpublish
Queues a schedule to run now instead of at its executeAt time. Each content item in the schedule is published or unpublished according to its scheduled action. A schedule that is already running or has succeeded is returned unchanged.
Arguments
- Name
id- Type
- ID!
- Description
The ID of the schedule you want to run.
Returns
- Name
Schedule.*- Type
- Schedule!
- Description
Any requested field from the Schedule object.
Request
import { PackClient } from '@pack/client'
const packClient = new PackClient({
token: 'YOUR-PACK-TOKEN',
})
const query = `
mutation SchedulePublishUnpublish($id: ID!) {
schedulePublishUnpublish(id: $id) {
id
title
state
}
}
`
const variables = {
id: 'schedule-id',
}
const response = await packClient.fetch(query, { variables })
console.log(response.data)
Response
{
"data": {
"schedulePublishUnpublish": {
"id": "schedule-id",
"title": "Holiday launch",
"state": "queued"
}
}
}