Back to Content Management API

sectionReferences

Returns a list of pages, templates, and other content where the section is used.

Arguments

  • Name
    id
    Type
    ID!
    Description

    The ID of the section of which you want to find its references.

Returns

  • Name
    Reference.*
    Type
    [Reference!]!
    Description

    A list of references that this section is used in. Each reference has id: ID!, title: String!, handle: String!, and contentType: ContentType!.

Request

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

const query = `
query SectionReferences($id: ID!) {
  sectionReferences(id: $id) {
    id
    title
    handle
    contentType
  }
}
`
const variables = {
  id: 'section-id',
}
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);

Response

{
    "data": {
        "sectionReferences": [
            {
                "id": "page-id",
                "title": "Home",
                "handle": "home",
                "contentType": "page"
            }
        ]
    }
}

Was this page helpful?