Create custom monitoring dashboards for SP-API apps in Postman
by Tsuneki U., Solution Reliability Engineer, Selling Partner Developer Services | January 9, 2023
Overview
This blog describes how to use Postman to create a custom monitoring dashboard for Selling Partner API (SP-API) apps. The monitoring feature in Postman allows you to set up regular, automated checks on your API endpoints and provides a convenient and effective way to keep track of the health and performance of the API.
Benefits
Creating a custom monitoring dashboard can help you simplify the following tasks:
- Automate periodic SP-API app health and performance checks
- Receive outage notifications promptly
- Identify API specification response changes
- Test complex, multi-step workflows
- Gain visibility into API performance over time and identify trends
The following images show an example dashboard its test results.

Monitoring dashboard example

Test results example
Tutorial
This tutorial takes approximately 1 hour to complete.
Prerequisites
- Download Postman from https://www.postman.com/downloads/.
- Create and sign in to a Postman account
- Create a Postman Workspace
- Create a Postman Collection
Step 1. Create a workflow for an API operation
Note: In this blog, we use CatalogItems API v2022-04-01 as an example.
- Open your Postman Collection.
- From the top-right corner, select Environment quick look.
- Choose Add.
- Enter the name for your Environment.

Create the environment for the health dashboard
- From the top-right corner, select Manage Environments.
- Choose your Environment.
- Choose Edit.
- Enter the variables from the following Environment values table.
- Choose Save.
Note:
The secret variable type allows masking of initial and current values which reduces manual copy/paste effort and prevents the unintentional disclosure of sensitive information. Setting a variable to the secret type masks its value to all workspace members. You can use the environment variables in your requests by enclosing the variable name in double curly braces (for example,
{{variable_name}}
). When you send a request, Postman will substitute the variable with the corresponding value from your environment.
Environment values:
Variable | Type | InitialValue and CurrentValue |
---|---|---|
IamUserAccessKey | Secret | AWS IAM User AccessKey |
IamUserSecretKey | Secret | AWS IAM User SecretKey |
IamRoleARN | Secret | AWS IAM Role ARN |
AppClientId | Secret | LWA client ID of your application |
AppClientSecret | Secret | LWA client secret of your application |
sts-url | Default | https://sts.amazonaws.com |
auth-url | Default | https://api.amazon.com/auth/o2/token |
sp-api-url-prod | Default | https://sellingpartnerapi-na.amazon.com |

Example environment variables
Step 2. Create an AWS Security Token Service (AWS STS) request.
- Select the view more menu to the right of your new collection.
- Choose Add request.
- Enter a name for the request.
- Choose GET.
- In the request URL field, enter the URL for the STS endpoint. Note: The endpoint should use the
{{ sts-url }}
format. - Choose the Params tab.
- Enter the values from the following Params table.
- Choose the Authorization tab.
- Enter the values from the following Authorization table.
- Choose Send.

Example of STS request Params tab
Params:
KEY | VALUE |
---|---|
Version | 2011-06-15 |
Action | AssumeRole |
RoleSessionName | SP-APIHealthDashBoard |
RoleArn | {{IamRoleARN}} |
DurationSections | 3600 |
Authorization:
Type | AWS Signature |
AccessKey | {{IamUserAccessKey}} |
SecretKey | {{IamUserSecretKey}} |
AWS Region | us-east-1 |
Service Name | sts |
- Choose the Tests tab.
- Include a script that sets the temporary AccessKeyId, temporary SecretKey, and SessionToken to the Local variables to be used in the getCatalogItem call.
The local variable is scoped to single request or collection run and becomes unavailable after the request or run is complete.

Example Tests tab
Example test:
var jsonObject = xml2Json(responseBody);
pm.variables.set("SessionToken", jsonObject.AssumeRoleResponse.AssumeRoleResult.Credentials.SessionToken);
pm.variables.set("TempAccessKeyId", jsonObject.AssumeRoleResponse.AssumeRoleResult.Credentials.AccessKeyId);
pm.variables.set("TempSecretKey", jsonObject.AssumeRoleResponse.AssumeRoleResult.Credentials.SecretAccessKey);
- Select the view more menu to the right of your new collection.
- Choose Add request.
- Enter a name for the request.
- Select GET.
- Enter the URL of the getCatalogItem endpoint, which should be in the format of
{{ sp-api-url-prod }}/catalog/2022-04-01/items/:asin
. Note: The getCatalogItem endpoint requires query parameters, path parameters, authorization and access token in the header. - Enter the following values into the Params tab, Authorization tab, and Header tab.
Query Params:
KEY | VALUE |
---|---|
marketplaceIds | ATVPDKIKX0DER |
includeData | summaries |
Path Params:
KEY | VALUE |
---|---|
asin | B00QSR9URI |
Authorization:
Type | AWS Signature |
AccessKey | {{TempAccessKeyId}} |
SecretKey | {{TempSecretKey}} |
AWS Region | us-east-1 |
Service Name | execute-api |
Session Token | {{SessionToken}} |
Headers:
KEY | VALUE |
---|---|
x-amz-access-token | {{currentAccessToken}} |
- Choose the Pre-request tab.
- Enter the following script. This script references the Environment variables and sets the LWA access token to “currentAccessToken” local variable which is referred by x-amz-access-token in the Headers tab.
Pre-request Script:
var clientId = pm.environment.get('AppClientId');
var clientSecret = pm.environment.get('AppClientSecret');
var refreshToken = pm.environment.get('AppRefreshToken');
var authURL = pm.environment.get('auth-url');
const echoPostRequest = {
url: authURL,
method: 'POST',
header: 'Content-Type:application/json',
body: {
mode: 'application/json',
raw: JSON.stringify(
{
grant_type: 'refresh_token',
refresh_token: refreshToken,
client_id: clientId,
client_secret: clientSecret
})
}
};
var token = pm.variables.get('currentAccessToken');
var tokenExpiry = pm.variables.get('accessTokenExpiry');
if (!token || !tokenExpiry || tokenExpiry <= (new Date()).getTime()) {
pm.sendRequest(echoPostRequest, function (err, res) {
console.log(err ? err : res.json());
if (err === null && res.status != 'Unauthorized') {
console.log('Saving new token and expiry');
var responseJson = res.json();
pm.variables.set('currentAccessToken', responseJson.access_token)
var expiryDate = new Date();
expiryDate.setSeconds(expiryDate.getSeconds() + responseJson.expires_in);
pm.variables.set('accessTokenExpiry', expiryDate.getTime());
}
});
}
else {
console.log("Token still good");
}
Step 3. Write a test for the API operation
- Choose the Tests tab.
- Enter the following test code snippets. This code tests if the response has a status code of 200 and includes expected attributes for ItemSummaries.

Test script for getCatalogItem
Tests:
pm.test('Status code should be 200', ()=> {
pm.response.to.have.status(200);
})
var jsonData = pm.response.json()
pm.test('getCatalogItem summary includes expected attributes', ()=> {
pm.expect(jsonData.summaries[0]).to.deep.include.keys([
'marketplaceId',
'brand',
'browseClassification',
'itemName',
'manufacturer',
'modelNumber',
'partNumber',
'size'])
})
- Select the view more menu next to the collection.
- Choose Run collection.
- Confirm that the test passes.
Step 4. Start the monitor in Postman
- Select the view more menu next to the collection.
- Choose Monitor collection.
- Enter the monitor name, frequency for running the monitor, and email address for notifications.
- Specify the environment for the monitor.
- Choose Create monitor.

Create a monitor

Monitor customizations
Step 5. Check API status
The monitor screen allows you to view the results of each API call as well as the workflow execution log. If there are variables you wish to check, we recommend using console.log.

Monitoring screen

Test results
Conclusion
This blog introduced how to use Postman's testing and monitoring features to periodically examine the health of the SP-API. It also explained the benefits of monitoring the health of the SP-API on the client side, which can speed up debugging and make application operations and maintenance more efficient.
For more information, refer to:
Have feedback on this post?
If you have questions or feedback on this post, we'd like to hear from you! Please vote and leave a comment using the tools at the bottom of this page.
Subscribe to updates via RSS feed.
Updated 5 months ago