Back to Content Management API
templateCreate
Creates a template.
Arguments
- Name
input
- Type
- TemplateCreateInput!
- Description
An object.
title
:String!
type
:String!
sectionIds
:[ID!]
Returns
- Name
Template.*
- Type
- Template
- Description
Any requested field from the Template object.
Request
import { PackClient } from '@pack/client'
const packClient = new PackClient({
token: 'YOUR-PACK-TOKEN'
});
const query = `
mutation TemplateCreate($input: TemplateCreateInput!) {
templateCreate(input: $input) {
id
title
type
sectionIds
}
}
`;
const variables = {
input: {
title: 'YOUR-TEMPLATE-TITLE',
type: 'YOUR-TEMPLATE-TYPE',
sectionIds: ['YOUR-SECTION-ID']
}
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"templateCreate": {
"id": "TEMPLATE_ID",
"title": "TEMPLATE_TITLE",
"type": "TEMPLATE_TYPE",
"sectionIds": ["SECTION_ID"]
}
}
}