Back to Content Management API
templateReferences
Returns a list of references where the template is used.
Arguments
- Name
id
- Type
- ID!
- Description
The ID of the template of which you want to find its references.
Returns
- Name
Reference.*
- Type
- [Reference!]!
- Description
A list of references that this template is used in.
Request
import { PackClient } from '@pack/client'
const packClient = new PackClient({
token: 'YOUR-PACK-TOKEN'
});
const query = `
query TemplateReferences($id: ID!) {
templateReferences(id: $id) {
id
title
handle
contentType
}
}
`
const variables = {
id: 'template-id',
}
const response = await packClient.fetch(query, { variables: variables });
console.log(response.data);
Response
{
"data": {
"templateReferences": [
{
"id": "page-id",
"title": "Page Title",
"handle": "page-handle",
"contentType": "page"
},
{
"id": "page-id",
"title": "Page Title",
"handle": "page-handle",
"contentType": "page"
},
]
}
}