Custom Content Delivery API development
Overview of custom CDA development
For stable production functionality, it typically makes more sense to build a custom Content Delivery endpoint via code, rather than entirely through editorial configuration. An endpoint class can ensure that a fixed set of APIs are exposed with configuration that should not change between different environments.
Implementing custom CDAs
- Create a new Java class extending ContentDeliveryApiEndpoint.
- Implement required methods:
getPathSuffix—appended to/graphql/delivery/to create the path where the API endpoint is available.getQueryEntryFields—objects wrapping view model and interface classes used to generate the schema and expose APIs.
Example:
showLineNumbers
1public class FooContentDeliveryApiEndpoint extends ContentDeliveryApiEndpoint {23@Override4protected String getPathSuffix() {5return "foo"; // API endpoint is available at path '/graphql/delivery/foo'6}78@Override9public List<ContentDeliveryEntryPointField> getQueryEntryFields() {10return Arrays.asList(11new ContentDeliveryEntryPointField(FooViewModel.class),12new ContentDeliveryEntryPointField(BarViewModel.class));13}14}