Contentful logo

Contentful Community

Is there any way to use content preview to preview changed in changing?

Is there any way to use content preview to preview changed in changing ?

I have made lots of changes to a single page in my staging environment to the content and content models but when I click the preview content button on the staging page it still shows the page as it is in the master environment ???

How can I preview my page as it is in the staging environment ?

Thanks

Ricky

Hey Ricky,

You’d need to use both our Preview API (So using a preview API Key, and setting the host to our Preview domain) and environments when making a request. For example if you made a Query Entry request (https://www.contentful.com/developers/docs/references/content-preview-api/#/reference/links/links-to-a-specific-item) it would look something like this:

curl --include \
     --request GET \
     https://preview.contentful.com/spaces/{space_id}/environments/{staging_environment_id}/entries?access_token={preview_access_token}&include={include}

I wrote an article about some of the concerns that might happen when you mix these 2 features that might be interesting to you - https://www.contentful.com/blog/2019/04/17/preview-editors-and-developers/. The TL;DR though is that the preview api is built for editors and environments are built for devs. Mixing them can cause issues. We’d encourage you at this point to just use one depending on what you do.

1 Like