Table of Contents
Understanding and visualizing the relationships between objects in an unfamiliar platform can be challenging. At Administrate, we’ve found that Postman can be a useful tool for exploring GraphQL APIs and quickly mocking up example queries and mutations. Once you’ve installed Postman, you will first need to retrieve an auth token using the authorization documentation.
Methods of Using GraphQL
Postman has two ways of interacting with a GraphQL API. Both options are useful, but the second is the primary method covered in this article.
HTTP Request
The first method uses a standard HTTP request and configures the request body for GraphQL. If you already use Postman, you are likely familiar with HTTP requests for REST APIs. While HTTP requests in Postman are more full-featured, they do not include one key feature available in the second method: the Schema Explorer.
GraphQL Request (preferred)
The second method uses Postman’s dedicated GraphQL request type. This method includes the Schema Explorer, which you can use to quickly mock up queries and mutations, as well as explore relationships between objects in our GraphQL API. To do this, in the top left of your Postman application, click New and select GraphQL.
This opens a view like the one below.
For the Core API, enter the URL https://api.getadministrate.com/graphql and configure your Authorization tab. Depending on how you obtained your access token, you may use either OAuth 2.0 or Bearer Token as the auth type. Once you have entered the URL and configured authorization, select the Query tab and click Use GraphQL Introspection.
Exploring the GraphQL API
Now that you have configured Postman to use the Schema Explorer in a GraphQL request, let’s look at an example. Say you want to query your list of accounts in Administrate and return the newest account with its ID and name. You also want to see all contacts associated with that account, again with their ID and name. Using the Schema Explorer, you can mock up this query in less than a minute.
This demonstration covers the Core API, but the same method can be used to explore the LMS and WebLink APIs because all three are GraphQL APIs.
API URLs
- Core: https://api.getadministrate.com/graphql
- LMS: https://lms-api.administratehq.com/graphql
- WebLink: https://weblink-api.administratehq.com/graphql
Note: A token retrieved for the Core API will not be valid for the LMS or WebLink APIs. Refer to the authorization documentation for the appropriate API.
Troubleshooting
Error: "Could not load GraphQL schema"
If you see the error Could not load GraphQL schema, check that your token is valid, the URL is correct, and you are not missing any required headers. This is especially important for the WebLink API.
Authorization Documentation
Help Center documentation
Developer Portal documentation