Connecting to the API
How to use the GraphQL Playground client to connect to the BaseCMS GraphQL API.
Last updated
How to use the GraphQL Playground client to connect to the BaseCMS GraphQL API.
Last updated
For a high-level overview of GraphQL and connection information, review the Getting Started section.
In this guide, we'll be using the GraphQL Playground client. You can feel free to use any API client but we think the GraphQL Playground has the best native autocompletion and schema visibility. Other commonly used clients are Insomnia, Altair, or Postman.
You'll need the following information to query the API:
An API URL
A Tenant Key
If you're missing any of this information, please reach out to support@parameter1.com and we'd be happy to provide it!
To get started, open the GraphQL Playground client and select New Workspace. Select the option to use a URL endpoint, and input your API URL:
Once you click open, your workspace will open up. Before you can make any queries against the API, you need to identify your tenant. To do so, add the x-tenant-key
header to your client's configuration. In the GraphQL Playground, you can add that to the "HTTP Headers" tab:
Now that you've configured your API client, you can use a feature of GraphQL called introspection. Introspection allows you to browse the schema from your client, without access to the underlying codebase. To browse the schema, you can use the "Schema" (Raw output) or "Docs" (searchable, with comments) tabs on the right side of the screen.
For a high-level overview of the authentication process, review the Modifying data: Introduction guide.
In order to modify data via the GraphQL API, you must be authenticated with a valid user token. To obtain this token, send a request to the login
mutation, supplying your BASE username and password.
The returned token should be presented via the Authentication
header with a Bearer
prefix.
In order to use certain mutations that modify data, you will need to specify your BASE instance URL. You can do so by including the URL in the x-base4-api-uri
HTTP header.