In this tutorial, you will learn how to quickly set up a Postman collection to start working with the gridX API!
We will go through how to make your first request using your bearer token and then how to use it to create a personal token for further requests.
Prerequisites
To follow this guide, you will need
Steps
-
Download our API specs.
-
Head over to Postman, click on the Collections tab and select
Importwith the OpenAPI file you just downloaded.
A new collection entitledSolution APIshould now be available.
-
Retrieve your bearer token from Xenon in the user settings.
-
Create a new Postman environment and store your bearer token in a secret variable called
bearerTokenas shown below.
-
Click on the
Solution APIcollection and select theAuthorizationtab.
We now need to set up the authorization header to use our bearer token for all endpoints of the collection.
Choose the auth typeBearerwith the variablebearerTokencreated in the previous step.
You now have everything set up to start calling the gridX API!
However, one downside of using bearer tokens is that they are short-lived, so you would have to overwrite your bearerToken variable every time it expires.
To provide a better experience, let’s create a personal token with a longer expiry date.
-
Navigate the collection through the collection and click on the endpoint “Create a Token” as shown below. In the
Authorizationtab, make sure the auth is inherited from the collection.
-
Make sure you have selected your Postman environment and call the endpoint with an expiry date in the future (e.g. in 6 months). You should get back a personal token in the response.
Warning: This token must be stored securely like any password.
-
Head back over to the environment page and create a new
tokensecret to store your personal token.
-
Personal tokens are used a bit differently from bearer tokens. They should also be part of the authorization header but they require the prefix
Token. Navigate to the collection’s authorization tab and change the auth type toAPI Keywith the prefixTokenfollowed by your token. Make sure it is added to the header of the request and save the changes.
-
You can now call any endpoint with your personal token! For example, let’s retrieve the authenticated user.
Don’t forget to check that the authorization is inherited from the parent.









