Back to Content Management API

blogAddSectionsBulk

Assign a sections to multiple blogs.

Arguments

  • Name
    ids
    Type
    [ID!]
    Description

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

  • Name
    input
    Type
    [BlogAddSectionsInput!]!
    Description

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

    • 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 BlogAddSectionsBulk($ids: [ID!]!, $input: [BlogAddSectionsInput!]!) {
    blogAddSectionsBulk(ids: $ids, input: $input) {
      id
    }
  }
`;

const variables = {
  "ids": ["blog-id-1", "blog-id-2"],
  "input": [
    {
      "sectionIds": ["section-id-1", "section-id-2"],
      "strategy": "clone"
    }
  ]
}

const response = await packClient.fetch(query, { variables:
variables
});
console.log(response.data);

Response

{
    "data": {
        "blogAddSectionsBulk": {
          "id": "1"
        }
    }
}

Was this page helpful?