This guide walks through creating a Content Endpoint, querying it via the Content API, and setting up a Content Webhook. For background on key concepts and API details, see the Streams Overview.
Step 1: Create a Content Endpoint
Best practice: Take a conservative approach to creating Content Endpoints. Each endpoint generates its own index and receives updates for every entity it includes. The more endpoints an entity is referenced in, the longer data updates take to propagate. Consolidate overlapping endpoints where possible and archive endpoints that are no longer needed.
Option A: Content Endpoints UI
- Navigate to Developer > Content Endpoints.
- Click + Add Endpoint in the top right.
- Enter a Name and ID.
- Select your Source and configure the filter:
-
Knowledge Graph:
- Select the relevant filter to determine which entities to include.
- Select the criteria for each filter type — this will be by Entity Type, Saved Filter, or specific set of entities.
- Select the localization codes to stream records for. By default, the primary locale of the entities will be included in the Content Endpoint.
- If relevant, enable certified facts, a signed verifiable snapshot of core Knowledge Graph fields. To learn more, check out the Brand Certified Facts doc.
- Reviews or ReviewsAgg: Select the relevant publishers.
-
Knowledge Graph:
- Click Add Fields, select the fields to include, and confirm.
- Click Select Indexed Fields, select the fields you want to be queryable via the Content API, and confirm.
- Click Save.
Option B: Configuration as Code
Add a new Content Endpoint resource via the Admin Console or Yext CLI. See the schema reference for the full resource definition.
Once you create and apply this new resource, a Content Endpoint will be instantiated with the ID you provided. It may take some time to refresh the data so that it is available for querying.
Option C: Install an App
Rather than configuring a Content Endpoint from scratch, you can also install any App which contains a Content Endpoint CaC file. You can then modify this CaC file directly to update the configuration of the Content Endpoint, allowing you to add fields to the response, index additional fields, etc.
For example, the Content Endpoints for Reviews app contains configuration for two Content Endpoints, one for individual review data and another for reviews aggregate data (average rating and review count). Once this app is installed, you’ll be able to leverage the Content Endpoints in your account via the Content API or Content Webhooks.
Step 2: Making Requests to a Content Endpoint via the Content API
- Create an app in the Developer Console and grant it the Content API permission group. This grants read access to all Content Endpoints in the account.
- Construct your request. See the Content API section of the Streams Overview for:
- Base URLs
- Get by ID Requests. Requests will require an ID of the primary key, which varies depending on the source.
-
Get by List Requests. The more common request type is a List request, which allows the requester to pass query parameters which filter to filter the results using any of the fields included in the
fieldIndexesproperty.
For full API documentation, see the Content API documentation.
Step 3: Create a Content Webhook
Content Webhooks allow users to receive webhook messages based on the data configured for a Content Endpoint. In order to create a Content Webhook, you should first configure the relevant Content Endpoint, which contains the data you are interested in receiving updates for.
The Content Webhook will send a message to the provided webhook destination whenever there is an update to any of the fields included in the Content Endpoint configuration. If you only wish to use a Content Endpoint for a Webhook, there is no need to index any fields (within the fieldIndexes property), since you will not need to query the endpoint.
Once you have configured the Content Endpoint which contains the data you would like to receive via webhook, you’ll need to go through the standard “Add Webhook Flow”.
- Navigate to Developer > Developer Console and select the relevant app.
- Click the Webhooks tab.
- Click Add a Webhook and select Content as the webhook type.
- Select the Content Endpoint you want to trigger the webhook.
- Complete the configuration and save.
You should now receive messages at the provided URL whenever any of the data included in the selected Content endpoint changes.