Back to Content Management API

templateAddSectionsBulk

Assigns a sections to multiple templates.

Arguments

  • Name
    ids
    Type
    [ID!]
    Description

    Array of template IDs that you want to add sections to.

  • Name
    input
    Type
    [TemplateAddSectionsInput!]!
    Description

    An object that takes in an array of sectionIds and a srategy for how to handle the sections attached to the templates.

    • sectionIds: array of section IDs
    • strategy: clone | link

Returns

  • Name
    Job.*
    Type
    Job
    Description

    Any requested field from the Job object.

Request

import { PackClient } from '@pack/client'
const packClient = new PackClient({
  token: 'YOUR-PACK-TOKEN'
});

const query = `
  mutation TemplateAddSectionsBulk($ids: [ID!]!, $input: [TemplateAddSectionsInput!]!) {
    templateAddSectionsBulk(ids: $ids, input: $input) {
      id
    }
  }
`;

const variables = {
  ids: ['TEMPLATE_ID'],
  input: [
    {
      sectionIds: ['SECTION_ID'],
      strategy: 'clone'
    }
  ]
};
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);

Response

{
  "data": {
    "templateAddSectionsBulk": {
        "id": "JOB_ID"
    }
  }
}

Was this page helpful?