How to configure a different Integration Field endpoint in a Prismic development environment

Integration Fields and cloned Environments

Prismic Environments allows you to create a clone of your production repository into a staging or development environment. This is highly recommended when you need to iterate on your content schema safely.

When cloning a repository that uses Integration Fields, the configuration is ported to the clone, but you can not modify it on the cloned environment. If the original repository has documents with products linked to them via Integration Fields, these links will be preserved in the clone:

  • In the Writing Room, you'll see that the products populated in production are still attached to the documents in the clone.
  • on the API side, you'll see that the data embedded in the original document is present on the API responses of the clone. This data keeps syncing with the data source configured in production (if your production Integration endpoint exposes updated data, it will update the documents' API response in the clone after the sync delay).

Configure different Integration Fields endpoints in cloned environments

You might need to have the Integration Fields of your cloned environments pointing to a different data source endpoint in some cases.

Let's say you have a production repository with a "Product Catalog - Production" Integration Field configured and that you need to configure a different data source "Product Catalog - Staging" in your staging-cloned repository.

To achieve this, after having your production repository cloned, head to the Integration Fields settings of the cloned environment; as mentioned before, you won't be able to edit the Integration Fields production endpoints that have been copied, but you can create other ones:

  • Create a new Integration Field, name it, for instance, "Product Catalog - Staging," and input the URL of the staging data source for your product catalog
  • Change the ID of the catalog in all custom types and Slices where this Integration Field is used. If you don't know the ID of your staging catalog, just drop a temporary "Product Catalog - Staging" widget into one custom type, you'll see its ID appear in the JSON Editor.
{
  "Main":{
    "product_name":{
      "type":"StructuredText",
      "config":{
        "single":"heading1",
        "label":"Product name",
        "placeholder":"Product name"
      }
    },
    "product_id":{
      "type":"IntegrationFields",
      "config":{
        "catalog":"eshop-prod--prod_catalog",
        "label":"Product ID",
        "placeholder":"Product ID"
      }
    }
  }
}

What happens after changing the catalog config?

  • A document cloned from production with product data already attached will remain unchanged on the clone; it will keep the original data (from the original Integration Field data source) attached to it
  • From the Writing Room, when clicking on this Integration Field, content editors will now see in the side panel the items exposed by the new endpoint

Promoting your content schema from staging to production

When new features have been validated against your staging Integration data source, you will have to promote the custom type JSON configuration from your staging repository to your production repository. When doing this, if you have altered the catalog ID config in your Staging custom types, make sure to set back the production catalog ID before applying content schema changes to your production repo.

Threads close after a period of inactivity. Flag this thread to re-open it and continue the conversation.