Back to Content Management API

sectionRestore

Restores a section to a specific revision.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the section you want to restore.

  • Name
    revisionId
    Type
    ID!
    Description

    The ID of the revision you want to use to restore.

Returns

  • Name
    Section.*
    Type
    Section
    Description

    Any requested field from the section object.

Request

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

const query = `
  mutation sectionRestore($id: ID!, $revisionId: ID!) {
    sectionRestore(id: $id, revisionId: $revisionId) {
      id
      title
      status
    }
  }
`;

const variables = {
  id: 'YOUR-SECTION-ID',
  revisionId: 'YOUR-REVISION-ID'
};

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

Response

{
    "data": {
        "sectionRestore": {
            "id": "SECTION_ID",
            "title": "SECTION_NAME",
            "status": "SECTION_STATUS"
        }
    }
}

Was this page helpful?