Consume Pet Store API using Postman

Manjula Rathnayake
Mar 30, 2018 · 2 min read

This demonstrate how to consume Pet Store API published in WSO2 API Cloud using postman collection. This assumes you have prior basic knowledge on postman. If not refer to first.

Complete API publish example at

  1. Refer to to get the postman collection and data file.
  2. In Default.postman_environment.json file update tenantDomain value to match with your organization name in WSO2 API Cloud.

“enabled”: true,
“key”: “tenantDomain”,
“value”: “devcicd”,
“type”: “text”

3. Import the postman collection and environment json files to Postman.

Postman collection to get an access token

4. Set two global variables as username and password below.

username = your username in wso2 cloud (

password = your password in wso2 cloud

5. Run postman runner.

If you use newman,

newman run TESTS_PET_STORE_API_IN_WSO2_API_CLOUD.postman_collection.json -e Default.postman_environment.json --global-var --global-var password=xxx


→ Dynamic Client Registration
POST [200 OK, 594B, 3s]

→ Get Access Token with apim:subscribe scope
POST [200 OK, 447B, 852ms]

→ Get OAuth App
GET [200 OK, 589B, 1850ms]

Attempting to set next request to Get API

→ Get API
GET [200 OK, 654B, 748ms]

→ Subscribe to API
POST [409 Conflict, 565B, 842ms]

→ Get Application Details
GET [200 OK, 1.09KB, 466ms]

Attempting to set next request to Generate Access Token

→ Generate Access Token
POST [200 OK, 406B, 399ms]

→ Returns pet inventories by status
GET [200 OK, 557B, 6.8s]

│ ‘{“sold”:62,”pissedoff”:1,”green”:1,”string”:301,”-1":1,”pending”:47,”available”:5481,”1available”:1,”available;pending;sold”:5,”O
│ ffline”:1,”ad ut aliqua quis”:1,”kjk”:1,”AVAILABLE”:24,”onDemand”:1,”Sold”:2,”UNAVAILABLE”:15,”Available”:9,”availablez”:1,”status”:6}’

You can import the swagger file of your API into the postman project and continue invoking other APIs too. Refer to

You may use direct OAuth2 support in postman tool to get access token too.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade