Content Publisher Delivery API
The following query allows to retrieve a document in order to publish it.
The $id refers to the document ID which is identical to the Google Docs ID in the case of using Google Docs.
The $contentType allows to choose either the MarkDown version of the content or the PantheonTree version which is based on the HAST specification.
query GetArticle(
$id: String
$contentType: ContentType # TREE_PANTHEON_V2|TEXT_MARKDOWN
) {
article(
id: $id
contentType: $contentType
) {
id
title
slug
tags
siteId
metadata
publishedDate
publishingLevel
contentType
resolvedContent
renderAsTabs
updatedAt
previewActiveUntil
content
}
}
The following query shows all the arguments that can be passed for fetching or searching articles. $filters allow to perform a full text search relying on Google Vertex AI Search.
query ListArticles(
$pageSize: Int
$sortBy: ArticleSortField
$sortOrder: SortOrder
$cursor: String
$metadataFilters: String
$contentType: ContentType
$publishingLevel: PublishingLevel
$filter: ArticleFilterInput
$preamble: String
) {
articlesv3(
pageSize: $pageSize
sortBy: $sortBy
sortOrder: $sortOrder
cursor: $cursor
metadataFilters: $metadataFilters
contentType: $contentType
publishingLevel: $publishingLevel
filter: $filter
preamble: $preamble
) {
articles {
id
title
siteId
tags
metadata
publishedDate
publishingLevel
contentType
resolvedContent
renderAsTabs
updatedAt
previewActiveUntil
snippet
}
}
}
As collection managers are able to customize the metadata configuration, it’s crucial developers can discover the metadata schema to best use content and metadata. Here is the query that retrieve the metadata configuration schema for a given collection ($id being the collection id):
query GetSiteMetadata($id: String!) {
site(id: $id) {
id
metadataFields
}
}
As collection managers are able to create specific content tree with sections, nested sections, nested documents and specific ordering of documents, developers can retrieve the tree for using it in their sites or app (example: building navigation). Here is the query ($id being the collection id):
query GetSiteContentStructure($id: String!) {
site(id: $id) {
id
contentStructure
}
}
Sites or apps using our GQL API can search by default inside the active collection configured on the site. For organizations having several collections configured on Content Publisher, it is also possible to perform a search across several collections and display the result on the site.
Here is an example how to do that from a GQL query (for example directly from https://gql.content.pantheon.io/ ):
Site main configuration:
{
"PCC-SITE-ID": "00JFiKjEul3756cieAIc",
"PCC-TOKEN": "PUT YOUR ACCESS TOKEN HERE"
}
The access token needs to be one allowing for access to all collections and not only the main collection referenced above.
Then query the Content Publisher Delivery API specifying addition collection ids (
query {
articlesv3 (
siteIds:["loAWY0YB0HTHexSzw3Z1", "lqAWY0YC0HTHexSzw1Z" ],
filter: {
body: {
contains: "your search query"
}
}) {
articles {
id
title
siteId
}
}
}
This query will naturally return articles from the three collections 00JFiKjEul3756cieAIc, loAWY0YB0HTHexSzw3Z1 and lqAWY0YC0HTHexSzw1Z.
Example: