We’ve discussed in the past how you can use Postman to create a collection to invoke the Stuart API. We have now publicised a Postman test collection to help get you started!
Pre-requisites: A Stuart Sandbox account
First you have to install Postman and create an account.
Go to the Stuart API documentation.
Click on the “Run in Postman” button on the top right corner, then select the options you want: app or browser, workspace… (More details here).
Click the drop down in the top right to switch to your newly created “Stuart API Sandbox” environment:
- Clicking on the “eye” allows us to see the environment variables that are present. Most of them are currently blank. You’ll only need to modify the oauth_client_id and oauth_client_secret to be equal to your API Client and API Secret listed under your Stuart Sandbox admin account details
You can also find collection’s variables by clicking on the Stuart API folder, then on the variables tab. Although they are blank for now, they are populated automatically by running the tests in the collection in sequence. Clicking on an individual test shows the request and response bodies.
You will need to authenticate to get a token in order to send requests. To do so, click on the "Stuart API V2 folder, then at the bottom of the “Authorization” tab, click on the "Get New Access Token button:
If you set up your credentials correctly, you will get a successful response, and it will generate a token named "access_token. Select this token in the "Current Token dropdown:
- Now that you have an access token, the rest of the collection can run successfully. However, these variables can be edited directly at any time if you wish to experiment with other calls as part of your tests.
Don’t forget you can also see the results of your calls on the Stuart dashboard!