Content Delivery Public Content API
Content Delivery exposes its content through the Public Content API, in the GraphQL query language. To interact with the API and the published content, use an in-browser GraphQL IDE such as GraphiQL.
Select this link to download the Public Content API reference documentation.
- The Public Content API and namespaces
Unlike the CIL (Content Interaction Libraries), the Public Content API is namespace-aware and ignores the value of theNamespaceelement in the Storage Layer configuration file, cd_storage_conf.xml. - Configuring the Public Content API endpoint
By default, the endpoint for the Public Content API is the following URL: BASEURL:PORT/cd/api, where BASEURL is the IP address or domain name of the server on which the Content Service runs, and PORT is the port number on which the service runs (defaults to 8081). You can change the endpoint in the application.properties file of the Content Service. - Obtaining and using an authentication token for GraphQL
In order to perform queries on the Public Content API from a graphical IDE such as GraphiQL, obtain an authentication token from the Content Delivery Token Service (which runs alongside the Discovery Service), then pass that token to GraphiQL in a request header in your requests. - Enabling GraphQL mutations
Public Content API supports GraphQL mutations, which make it possible to create, modify and delete data in an external system. To provide additional security, some additional configuration is required in your Content Delivery environment. - Passing along a preview session token when using Experience Manager
When requesting a session preview page for Experience Manager, ensure that you fetch the preview session token from a cookie and pass it into your GraphQL request in the form of an HTTP request header. - Public Content API classes and interfaces
The Public Content API exposes its data model through a number of classes and interfaces. - Types of Public Content API fields
There are different types of fields you can use or encounter when using the Public Content API. - Parameters for the page field
To fetch a Page, identify its namespace, Publication ID, and either its Page ID or relative URL. Alternatively, you can also fetch a Page using only its Content Manager URI. Adding specific context data lets you fetch absolute links rather than relative ones. - Parameters for the binaryComponent field
To fetch a binary resource, identify its namespace, Publication ID, and either its binary ID or the relative URL of one its variants. Alternatively, you can also fetch a binary resource using only the Content Manager URI of its corresponding Multimedia Component. - Structure of GraphQL queries
Use theitems()andcomponentPresentations()fields in your GraphQL query to fetch items from the Content Delivery environment. You can filter the returned items, limit them, sort them and paginate them. - GraphQL samples
This section contains a large collection of GraphQL request samples, to illustrate a variety of common query scenarios. - Customizing GraphQL querying in the Public Content API
Content Delivery allows you to customize and extend the GraphQL query language in the Public Content API in multiple ways.