How do I point my graphQL query to a particular release

I am wanting to point my graphQL queries to a particular release. With the REST api I normally do something like

const prismicRes = await api.query(
     [Prismic.Predicates.at(`my.${docName}.uid`, uid)],
     {
       fetchLinks: docFetchTypes,
       ref: process.env.PRISMIC_RELEASE_REF
     }
   );

Is there a way to point graphQL to a release ref?

1 Like

Hey,

Can you tell us which Framework and development kit you are trying to do this with? It varies from kit to kit.

Thanks.

Sure, I am using the apollo-link-prismic and apollo-client package in a node environment.

OK, I talked with my and to use another ref other than the master ref you will need to pass it like so:

client.query({
  query: blogPostQuery,
  context: {
    headers: {
      'Prismic-ref': releaseRef,
    },
  }
})

This article in our documentation will help you find your release ref using the REST api browser:
https://prismic.io/docs/rest-api/basics/the-api-browser#2_0-select-a-ref

You can visit your browser by going to https://your-repository-name.prismic.io/api/v2

Once you have it you can pass it like above.

1 Like

Perfect, thank you!!

1 Like