Authenticating your GraphQL API Call

In order to start querying your Content from Agility using GraphQL, you'll need to authenticate your requests and set up your GraphQL API client.

To start, head over to the GraphQL IDE Playground in your Instance by going to Settings > API Keys and clicking on the Explore GraphQL API button.

You'll notice your GraphQL API URL endpoint that you'll want to update to include the following:

  1. Your Instance GUID.
  2. Indicate whether you want to source Published Content (Fetch) or Staging Content (Preview).
  3. The locale you wish to retrieve content from.

Screen_Shot_2021-07-15_at_11.23.44_AM.png

Next, you'll also need to authenticate your request by adding your API Key as a header. To do this, click on the Set Headers button located on the left of the GraphQL API Playground.

Screen_Shot_2021-07-15_at_11.33.51_AM.png

Which API Key do I use?

If you're fetching Published content and have defined it by using `fetch` in your GraphQL API URL endpoint, be sure to use your Fetch API Key.

If you're fetching Staging content and have defined it by using `preview` in your GraphQL API URL endpoint, be sure to use your Preview API Key.

Screen_Shot_2021-07-15_at_11.34.24_AM.png

Click Save to save your API Key as a header in your request.

Once you've updated your GraphQL API URL and added your API Key as a header, you can click on the Reload button to reload the Docs.

Screen_Shot_2021-07-15_at_11.49.48_AM.png

Once you've reloaded the Docs, you can click on the Docs button, and you should see Root. If you click on Root, you'll then be able to see the Content queryable from your Instance.

Screen_Shot_2021-07-15_at_11.53.21_AM.png

 

2 out of 2 found this helpful

Comments

0 comments

Please sign in to leave a comment.