Getting started with the Public Content API
This section deals with some overall guidelines related to using the Public Content API, covering namespaces, authentication tokens and other issues of concern before you start coding.
- 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. - Content Manager Schemas and the Public Content API
The Semantic Type Modeling feature exposes Schemas and their fields, as defined in Content Manager, to the Public Content API so that you can query them and use them. In order to use them effectively, you, the web developer, must know what the Schemas are and what fields they contain. - 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. - Configuring caching of GraphQL requests
If your implementation makes many GraphQL requests in quick succession, you may want to cache GraphQL requests (request throttling) in a small in-memory cache in order not to overwhelm the Public Content API and improve performance, while also keeping database connections down.