Setting up environments in Postman can make interacting with the Avero API quick and easy. It only takes a few steps:
1. Set up authorization for your API
After you have an API in Postman, you'll need to configure it to authenticate using variable names instead of typing in your credentials every time.
Click on the “Avero Public API” sub-folder and do the following:
- Set the
Grant Type
toClient Credentials
- Set
Client ID
to{{client_id}}
- Set
Client Secret
to{{client_secret}}
- Save the tab! (ctrl+s, cmd+s, or click the
Save
button in the upper right)
The {{client_id}}
and {{client_secret}}
fields will be a dull red. This is because they are templated variables and you haven’t told Postman what values these should have yet. This is why you create environments, to tell the API what id and secret it should use!
2. Configure your environment(s)
Environments store values for our templated variables in Postman. You’ll want one environment for each customer or partner (i.e. set of credentials) you are using to talk to the API, this way it works almost like a password manager.
1. In the Environments
side panel, click Create Environment
, or use the New
menu and select Environment
.
2. Name your new environment. It should reflect the customer or partner this environment is for. Add a variable for client_id
and one for client_secret
and then populate the initial and current values with the values provided during credentials setup. It should look like the picture below:
Don’t forget to save your changes!
Once you’ve saved your environment it should now appear in the environment dropdown, where we currently see No Environment
.
3. Making an authenticated request
Now that we have our environment set up, we can make a fully authenticated request!
Select your environment from the environment dropdown (above).
1. Navigate to the Avero Public API
page where we set up our authorization earlier.
You should now see that {{client_id}}
and {{client_secret}}
are a brighter orange color like in the photo below, which means that Postman is pulling the values from the Environment using the templated variables. If these values are still bright red, it means your environment was not set up correctly!
2. Click Get New Access Token
. You will see a progress dialog that will automatically close and take you to the Manage Access Tokens
page below.
3. Click Use Token
and you’ll be brought back to the Authorization
page and the Access Token
field will be automatically populated.
We can finally make a real request!
5. Go back to the APIs
side panel, expand the Avero Public API
and open the top-level GET
request. Uncheck the checkbox next to Cursor
and click Send
In the results pane, you should now see data from the API response. Success!