Back to Content Management API
scheduleUpdate
Updates a schedule.
Arguments
- Name
input
- Type
- CreateScheduleInput!
- Description
An object.
title
:String
description
:String
executeAt
:DateTime
timezone
:String
content
: [ContentToSchedule!]
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 ScheduleUpdate($input: UpdateScheduleInput!) {
scheduleUpdate(input: $input) {
id
title
description
executeAt
timezone
content {
id
type
data
}
}
}
`;
const variables = {
"input": {
"id": "YOUR-SCHEDULE-ID",
"title": "New Schedule Title",
"description": "New Schedule Description",
"executeAt": "2022-01-01T00:00:00Z",
"timezone": "America/New_York",
"content": [
{
"id": "YOUR-CONTENT-ID",
"type": "page",
"data": {
"title": "New Page Title",
"handle": "new-page",
"description": "New Page Description",
"seo": {
"title": "New Page SEO Title",
"description": "New Page SEO Description",
"keywords": ["new", "page", "keywords"]
},
"sectionIds": ["YOUR-SECTION-ID"]
}
}
]
}
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"scheduleUpdate": {
"id": "YOUR-SCHEDULE-ID",
"title": "New Schedule Title",
"description": "New Schedule Description",
"executeAt": "2022-01-01T00:00:00Z",
"timezone": "America/New_York",
"content": [
{
"id": "YOUR-CONTENT-ID",
"type": "page",
"data": {
"title": "New Page Title",
"handle": "new-page",
"description": "New Page Description",
"seo": {
"title": "New Page SEO Title",
"description": "New Page SEO Description",
"keywords": ["new", "page", "keywords"]
},
"sectionIds": ["YOUR-SECTION-ID"]
}
}
]
}
}
}