Hi guys,
I'm trying to fix some issues with our existing v1 integration. We're using the ruby library.
My understanding of the preview flow is this:
- Click the preview button on any saved document, then click an environment
- Prismic redirects to an endpoint in your app with a unique token/ref used to look up the current draft version of a particular document. This token is in the form "https://myrepo.prismic.io/previews/abcd12345?websitePreviewId=defg6789"
- Your app remembers this token and redirects to another endpoint
- That endpoint uses the Prismic API to request the document
- Your app renders the document json
We're querying the API like this:
api
.form("everything")
.submit(ref) # unique ref for this preview instance
For some previews this works fine, but for others we get multiple documents being returned. Why are multiple documents being returned for a unique preview ref?
When a user launches a preview in the Writing Room, a temporary and secure ref (a token that references a specific content version) is generated for the preview session. Prismic sets a cookie with a token to access the preview.
On a related note, where can we find the HTTP API documentation for v1? We're currently using the ruby library as a reference which isn't ideal.