Integration Fields and cloned Environments
Using 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 safely iterate on your content schema.
When cloning a repository that has Integration Fields configured, the configuration is ported to the clone, but you can not modify it on the cloned environment.
If the original repository has documents populated 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, and this data keeps syncing with the data source configured in production (if your production Integration endpoint exposes updated data, it will update in the API response of the documents in the clone after the sync delay)
Configuring different Integration Fields endpoints in cloned environments
In some cases, you might need to have the Integration Fields of your cloned environments pointing to a different data source endpoint.
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
- once this is done, change the ID of the catalog in all custom types and Slices where this Integration Field is used
If you don't know what the ID of your staging catalog is, just drop a temporary "Product Catalog - Staging" widget into one custom type, you'll see its ID appear in the JSON Editor.
"label": "Product name",
"placeholder": "Product name"
"label": "Product ID",
"placeholder": "Product ID"
What happens after changing the
- 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.