Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mihinduranasinghe/4a15d53f06037f808b519e46df41d50f to your computer and use it in GitHub Desktop.
Save mihinduranasinghe/4a15d53f06037f808b519e46df41d50f to your computer and use it in GitHub Desktop.
Postman collection check for petstore API
{
"info": {
"_postman_id": "ea77bd33-13bb-4a5a-b185-7ddb65a623c2",
"name": "Sample Store",
"description": "This is a sample server online store",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "products",
"item": [
{
"name": "/products",
"event": [
{
"listen": "prerequest",
"script": {
"id": "bab4cbad-7633-48d0-af23-cf5f4ed0cdea",
"exec": [
""
],
"type": "text/javascript"
}
},
{
"listen": "test",
"script": {
"id": "2482982e-9382-458e-8306-519eb66cd848",
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "oauth2"
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{baseUrl}}/products?start=<string>&count=<string>&params=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"products"
],
"query": [
{
"key": "start",
"value": "<string>"
},
{
"key": "count",
"value": "<string>"
},
{
"key": "params",
"value": "<string>"
}
]
},
"description": "Get Product List"
},
"response": [
{
"name": "OK.\nList of Products is returned.\n",
"originalRequest": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{baseUrl}}/products?start=<string>&count=<string>&params=<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"products"
],
"query": [
{
"key": "start",
"value": "<string>"
},
{
"key": "count",
"value": "<string>"
},
{
"key": "params",
"value": "<string>"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [],
"body": "{\n \"list\": [\n {\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"price\": \"<string>\"\n },\n {\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"price\": \"<string>\"\n }\n ],\n \"total\": \"<long>\",\n \"offset\": \"<long>\",\n \"limit\": \"<long>\"\n}"
}
]
},
{
"name": "/products",
"event": [
{
"listen": "test",
"script": {
"id": "b7bd36ce-fe3c-4879-8d5f-c5f0a249858a",
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "oauth2"
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Floral Sleeveless Blouse\",\n \"description\": \"Womens Cotton Floral Sleeveless Blouse\",\n \"price\": \"$99.00\"\n}"
},
"url": {
"raw": "{{baseUrl}}/products",
"host": [
"{{baseUrl}}"
],
"path": [
"products"
]
},
"description": "Add a Product"
},
"response": [
{
"name": "Created.\nSuccessful response with the newly created object as entity in the body.\n",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"price\": \"<string>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/products",
"host": [
"{{baseUrl}}"
],
"path": [
"products"
]
}
},
"status": "Created",
"code": 201,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [],
"body": "{\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"price\": \"<string>\"\n}"
},
{
"name": "Unsupported Media Type.\nThe entity of the request was in a not supported format.\n",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"price\": \"<string>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/products",
"host": [
"{{baseUrl}}"
],
"path": [
"products"
]
}
},
"status": "Unsupported Media Type",
"code": 415,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [],
"body": "{\n \"code\": \"<long>\",\n \"message\": \"<string>\",\n \"description\": \"<string>\"\n}"
},
{
"name": "Bad Request.\nInvalid request or validation error.\n",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"price\": \"<string>\"\n}"
},
"url": {
"raw": "{{baseUrl}}/products",
"host": [
"{{baseUrl}}"
],
"path": [
"products"
]
}
},
"status": "Bad Request",
"code": 400,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [],
"body": "{\n \"code\": \"<long>\",\n \"message\": \"<string>\",\n \"description\": \"<string>\"\n}"
}
]
},
{
"name": "/products/:productId",
"event": [
{
"listen": "test",
"script": {
"id": "1492d368-b417-4035-b712-0c06276ceb61",
"exec": [
""
],
"type": "text/javascript"
}
}
],
"request": {
"auth": {
"type": "oauth2"
},
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{baseUrl}}/products/:newly_added_product_id",
"host": [
"{{baseUrl}}"
],
"path": [
"products",
":newly_added_product_id"
],
"variable": [
{
"key": "newly_added_product_id",
"value": "{{newly_added_product_id}}"
}
]
},
"description": "Get a Product"
},
"response": [
{
"name": "OK.\nProduct is returned.\n",
"originalRequest": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{baseUrl}}/products/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"products",
"<string>"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [],
"body": "{\n \"id\": \"<long>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"price\": \"<string>\"\n}"
},
{
"name": "Not Found\nInvalid product Id.\n",
"originalRequest": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{baseUrl}}/products/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"products",
"<string>"
]
}
},
"status": "Not Found",
"code": 404,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [],
"body": "{\n \"code\": \"<long>\",\n \"message\": \"<string>\",\n \"description\": \"<string>\"\n}"
},
{
"name": "Internal Server Error\nError while getting product\n",
"originalRequest": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{baseUrl}}/products/<string>",
"host": [
"{{baseUrl}}"
],
"path": [
"products",
"<string>"
]
}
},
"status": "Internal Server Error",
"code": 500,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"cookie": [],
"body": "{\n \"code\": \"<long>\",\n \"message\": \"<string>\",\n \"description\": \"<string>\"\n}"
}
]
}
]
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "0aaa43f3-6e74-4488-9e1e-d9df9bd5090f",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "a25e4ba7-6905-40a6-8a4b-cfdd98698715",
"type": "text/javascript",
"exec": [
""
]
}
}
],
"variable": [
{
"id": "fb418e8e-03f6-4f15-b76c-a193f0bc6bf4",
"key": "baseUrl",
"value": "https://host.docker.internal:8243/SampleStore/1.0.0",
"type": "string"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment