Skip to main content

Contentful Destination

Nexla's bi-directional connectors allow data to flow both to and from any location, making it simple to create a FlexFlow data flow that sends data to a Contentful location.
contentful_api.png

Contentful

Create a Contentful Destination

  1. Click the + icon on the Nexset that will be sent to the Contentful destination, and select the Send to Destination option from the menu.

  2. Select the Contentful connector from the list of available destination connectors. Then, select the credential that will be used to connect to the Contentful organization, and click Next; or, create a new Contentful credential for use in this flow.

  3. In Nexla, Contentful destinations can be created using pre-built endpoint templates, which expedite destination setup for common Contentful endpoints. Each template is designed specifically for the corresponding Contentful endpoint, making destination configuration easy and efficient.
    • To configure this destination using a template, follow the instructions in Configure Using a Template.

    Contentful destinations can also be configured manually, allowing you to send data to Contentful endpoints not included in the pre-built templates or apply further customizations to exactly suit your needs.
    • To configure this destination manually, follow the instructions in Configure Manually.

Use a Content Management token for all destination operations

All write operations send data to the Contentful Content Management API (CMA) at https://api.contentful.com. The access token in your selected credential must be a Content management token (personal access token) with write access. Content Delivery and Content Preview tokens are read-only and cannot be used for destination operations.

Configure Using a Template

Nexla provides pre-built templates that can be used to rapidly configure destinations to send data to common Contentful endpoints. Each template is designed specifically for the corresponding Contentful endpoint, making destination setup easy and efficient.

  • To configure this destination using a template, select the endpoint to which data will be sent from the Endpoint pulldown menu. Then, click on the template in the list below to expand it, and follow the instructions to configure additional endpoint settings.

    Create Content Type

    This endpoint creates a new content type in the space and environment configured in your credential. A content type defines the structure—the set of fields—that entries of that type will contain. Use this endpoint to provision new content models programmatically.

    • Each Nexset record is sent as the JSON body of a POST request to the content types collection. Map your Nexset so that each record contains a valid content type definition, including the name and a fields array describing the field schema.
    • No additional endpoint parameters are required. The space and environment are determined by your credential.

    In Contentful, a newly created content type is in a draft state and must be published before entries can be created against it. Publishing is a separate Content Management API operation.

    Update Content Type

    This endpoint updates an existing content type identified by its ID. Use it to modify a content type's fields or settings.

    • Enter the identifier of the content type to update in the Content Type ID field. This field is required. Content type IDs can be obtained from the List Content Types data source endpoint.
    • Each Nexset record is sent as the JSON body of a PUT request. Map your Nexset to contain the full, updated content type definition.

    Contentful uses optimistic locking for management updates. Updates typically require the current version of the resource (sent in the X-Contentful-Version header). For complete details, see the Contentful Content Management API documentation.

    Create Entry

    This endpoint creates a new entry in the space and environment configured in your credential. An entry is a single content record that conforms to a content type. Use this endpoint to push new content records into Contentful.

    • Enter the content type ID for the new entries in the Content Type ID field. This field is required. Nexla sends this value in the X-Contentful-Content-Type request header, which Contentful requires when creating an entry.
    • Each Nexset record is sent as the JSON body of a POST request. Map your Nexset so that each record contains a fields object whose keys match the fields defined on the target content type, with values keyed by locale (for example, {"fields": {"title": {"en-US": "My title"}}}).

    Newly created entries are in a draft state. Publish them with a separate Content Management API operation when they are ready to go live.

    Update Entry

    This endpoint replaces an existing entry identified by its ID with new field values. Use it to apply a full update to an entry's content.

    • Enter the identifier of the entry to update in the Entry ID field. This field is required. Entry IDs can be obtained from the List Entries data source endpoint.
    • Each Nexset record is sent as the JSON body of a PUT request. Map your Nexset to contain the complete, updated fields object for the entry.

    Use Update Entry when you are replacing the full set of fields. To change only specific fields without sending the entire entry, use the Patch Entry endpoint instead.

    Patch Entry

    This endpoint partially updates an existing entry, modifying only the specified fields rather than replacing the entire entry. Use it for efficient, targeted updates.

    • Enter the identifier of the entry to patch in the Entry ID field. This field is required.
    • Each Nexset record is sent as the JSON body of a PATCH request. Map your Nexset to contain a JSON Patch document describing only the field changes to apply.

    The Patch Entry endpoint uses JSON Patch semantics. For the exact patch document format Contentful expects, see the Contentful Content Management API documentation.

    Create Asset

    This endpoint creates a new asset in the space and environment configured in your credential. Assets represent files such as images, videos, audio files, and documents. Use this endpoint to register new files in Contentful.

    • Each Nexset record is sent as the JSON body of a POST request to the assets collection. Map your Nexset so that each record contains the asset's fields (such as title, description, and file), with values keyed by locale.
    • No additional endpoint parameters are required. The space and environment are determined by your credential.

    In Contentful, creating an asset registers its metadata. The asset must then be processed and published in separate Content Management API operations before it is available for delivery.

    Update Asset

    This endpoint updates an existing asset identified by its ID. Use it to modify an asset's title, description, file reference, or other metadata.

    • Enter the identifier of the asset to update in the Asset ID field. This field is required. Asset IDs can be obtained from the List Assets data source endpoint.
    • Each Nexset record is sent as the JSON body of a PUT request. Map your Nexset to contain the updated asset fields.

Configure Manually

Contentful destinations can be manually configured to send data to any valid Contentful Content Management API endpoint. Manual configuration provides flexibility for write operations not covered by pre-built templates, such as publishing entries and assets, managing tags, or targeting a specific environment.

Using manual configuration, you can also configure Nexla to automatically send the response received from the Contentful API after each call to a new Nexla webhook data source, which is useful for capturing the IDs and versions of resources created or updated in Contentful.

API Method

  1. To manually configure this destination, select the Advanced tab at the top of the configuration screen.

  2. Select the API method that will be used for calls to the Contentful API from the Method pulldown menu. Common methods for Contentful write operations are:

    • POST: For creating entries, assets, and content types.
    • PUT: For creating or replacing a resource at a known ID.
    • PATCH: For partial updates to an existing entry.

Data Format

  1. Select the format in which the Nexset data will be sent to the Contentful API from the Content Format pulldown menu. Contentful expects JSON, so select JSON. Nexla will automatically convert the data to the selected format for each API call.

API Endpoint URL

  1. Enter the URL of the Contentful Content Management API endpoint to which you want to send the Nexset data in the URL field, using the base URL https://api.contentful.com. For update operations, include the ID of the object to be updated at the end of the URL—for example, https://api.contentful.com/spaces/{'{space_id}'}/environments/{'{environment_id}'}/entries/{'{entry_id}'}.

Request Headers

Optional
  • If Nexla should include any additional request headers in API calls to this destination, enter the headers & corresponding values as comma-separated pairs in the Request Headers field (e.g., header1:value1,header2:value2). Common Contentful management headers include X-Contentful-Content-Type (required when creating an entry) and X-Contentful-Version (required for many update operations).

    You do not need to include any headers already present in the credentials. The Authorization header carrying your Contentful access token is added automatically by Nexla based on your credential configuration.

Exclude Attributes from the Call

Optional
  • If any record attributes in the Nexset should be omitted when sending data to this Contentful destination, select the attributes from the Exclude Attributes pulldown menu.

  • Any number of attributes can be selected for exclusion, and all excluded attributes will be shown in the field. To remove an attribute from the list, click the X icon next to the attribute name.

Record Batching

Optional
  1. If records should be sent to this destination in batched API calls, check the box next to Would you like to batch your records together? to enable record batching.

  2. Enter the maximum number of records that should be batched together in a single API call in the Batch Size field. By default, this value is set to 100.

  3. Select the algorithm that will be used to group records into batches from the Grouping Algorithm pulldown menu. The sample request shown in the panel on the right will be updated to reflect the current batching settings.

    The Contentful Content Management API creates and updates resources one at a time, with each entry, asset, or content type addressed by its own ID. For most Contentful write flows, leave batching disabled so that each Nexset record maps to a single API call.

Response Webhook

Optional

Nexla can automatically send the response received from the Contentful API after each call to a new Nexla webhook data source. This option allows you to keep track of the status of each API call and any additional information returned after each call, such as the ID and version of the created or updated resource.

  • To enable this option, check the box next to Would you like to process the API response as a Nexla Webhook source?.

Sample Request Payload

Sample request payloads containing a portion of the Nexset data that will be sent to the Contentful API endpoint based on the current settings are shown in the Sample Payload panel on the right. These samples can be referenced to ensure that the destination and request settings are correctly configured.

  • Click on a sample request payload to expand it and view the complete payload content.
  • Sample payloads are automatically updated with each setting change, making it easy to verify that changes achieve the desired effect.

Endpoint Testing (Manual Configuration)

After all endpoint settings have been configured, Nexla can send a test payload to the Contentful API to ensure that the destination is configured correctly.

  1. To send a test payload, select the Test button at the top of the Sample Payload panel, and click on a listed sample payload to expand it.

  2. If any modifications to the sample payload are needed, make the necessary changes directly within the sample window.

  3. Click the Send Test Data button at the top of a sample payload to send the test payload to the Contentful API using the current settings.

Save & Activate the Destination

  • Once all endpoint settings have been configured, click the Done button in the upper right corner of the screen to save and create the destination. To begin sending data to Contentful, open the destination resource menu, and select Activate.

    The Nexset data will not be sent to Contentful until the destination is activated. Destinations can be activated immediately or at a later time, providing full control over data movement.