Manual way of creating StoreFront APIs using Postman collection

Back to project

Creating/Adding Request to collection

Common Steps for Every Request

  1. If you highlight the collection you created, you can see an ellipses icon.
  2. Click on the ellipses icon, and you will see a menu which has an “add request” option in it. Click on it.

JWT Token API

  1. Do the Common Steps for Every Request step.
  2. Enter a valid name for the request for example if you are API is creating a JWT token using the storefront API give the name “create storefront3 jwt token”.
  3. In the URL window enter this URL http://{{myAzureIP}}/auth/jwt/create and the request type is POST
  4. In the authorization tab select type as “inherit auth from parent”.
  5. Switch to the body tab, select the raw option and JSON option
  6. Enter the username and password as a JSON object.
    These credentials are nothing but your superuser credentials, which you created in hop-2 step 6
{ "username": "lourduRohithReddyGali", "password": "Bhasker@123mgit$10" }
  1. In the tests tab Please add the following code
    The first line fetches the response as JSON
    The second line adds a collection Variable called “jwt_token”. We left this value empty in the first place because we are going to assign its value dynamically.
const response = pm.response.json();
pm.collectionVariables.set("jwt_token", response.access);
  1. Click on Send.
  2. As soon as you click send, in the response tab, you should see the output.

Get store products API

  1. Do the Common Steps for Every Request step.
  2. Enter a valid name for the request. Suggested name  “Get store products”
  3. In the URL window enter this URL http://{{myAzureIP}}/store/products and the request type is GET
  4. In the authorization tab select type as “inherit auth from parent”.
  5. Click on Send.
  6. As soon as you click send, in the response tab, you should see the output.

Get store products for page 2 filtered based on collection ID API

  1. Do the Common Steps for Every Request step.
  2. Enter a valid name for the request. Suggested name “Get store products for page 2 filtered based on collection ID”
  3. In the URL window enter this URL http://{{myAzureIP}}/store/products/?collection_id=3&page=2 and the request type is GET
  4. In the authorization tab select type as “inherit auth from parent”.
  5. Click on Send.
  6. As soon as you click send, in the response tab, you should see the output.

Get store product API

  1. Do the Common Steps for Every Request step.
  2. Enter a valid name for the request. Suggested name  “Get store product”
  3. In the URL window enter this URL http://{{myAzureIP}}/store/products/905 and the request type is GET
  4. In the authorization tab select type as “inherit auth from parent”.
  5. Click on Send.
  6. As soon as you click send, in the response tab, you should see the output.

Update products details API

  1. Do the Common Steps for Every Request step.
  2. Enter a valid name for the request. Suggested name  “update products details”
  3. In the URL window enter this URL http://{{myAzureIP}}/store/products/905 and the request type is PUT
  4. In the authorization tab select type as “inherit auth from parent”.
  5. Switch to the body tab, select the raw option and JSON option
  6. Copy and paste the following object.
{
	"id": 905,
	"title": "Absolut Citron",
	"description": "dapibus dolor vel est donec odio justo sollicitudin ut suscipit a feugiat et eros",
	"slug": "-",
	"inventory": 32,
	"unit_price": 300.000,
	"price_with_tax": 97.02000000000001,
	"collection": 4,
	"images": []
}
  1. Click on Send.
  2. As soon as you click send, in the response tab, you should see the output.

Create a cart API

  1. Do the Common Steps for Every Request step.
  2. Enter a valid name for the request. Suggested name “Create a cart”
  3. In the URL window enter this URL http://{{myAzureIP}}/store/carts/ and the request type is POST
  4. In the authorization tab select type as “inherit auth from parent”.
  5. In the tests tab Please add the following code
    The first line fetches the response as JSON
    The second line adds a collection Variable called “cart_id” and its corresponding value which is
const response = pm.response.json(); 
pm.collectionVariables.set("cart_id", response.id);
  1. Click on Send.
  2. As soon as you click send, in the response tab, you should see the output.

Get the newly created cart API

  1. Do the Common Steps for Every Request step.
  2. Enter a valid name for the request. Suggested name “Get the newly created cart”
  3. In the URL window enter this URL http://{{myAzureIP}}/store/carts/{{cart_id}} and the request type is GET
  4. In the authorization tab select type as “inherit auth from parent”.
  5. Click on Send.
  6. As soon as you click send, in the response tab, you should see the output.

Add items to cart API

  1. Do the Common Steps for Every Request step.
  2. Enter a valid name for the request. Suggested name “add items to cart”
  3. In the URL window enter this URL http://{{myAzureIP}}/store/carts/{{cart_id}}/items/ and the request type is PUT
  4. In the authorization tab select type as “inherit auth from parent”.
  5. Switch to the body tab, select the raw option and JSON option
  6. Copy and paste the following object.
{  "product_id": 125,  "quantity": 2 } 
  1. Click on Send.
  2. As soon as you click send, in the response tab, you should see the output.

Create new order API

  1. Do the Common Steps for Every Request step.
  2. Enter a valid name for the request. Suggested name “create new order”
  3. In the URL window enter this URL http://{{myAzureIP}}/store/orders/ and the request type is POST
  4. In the authorization tab select type as “inherit auth from parent”.
  5. Switch to the body tab, select the raw option and JSON option
  6. Copy and paste the following object.
{ "cart_id" : "{{cart_id}}" }
  1. In the tests tab Please add the following code
    The first line fetches the response as JSON
    The second line adds a collection Variable called “order_id” and its corresponding value which is fetched from the response.
const response = pm.response.json(); 
pm.collectionVariables.set("order_id", response.id);
  1. Click on Send.
  2. As soon as you click send, in the response tab, you should see the output.

Get the newly created order API

  1. Do the Common Steps for Every Request step.
  2. Enter a valid name for the request. Suggested name “get the newly created order”
  3. In the URL window enter this URL http://{{myAzureIP}}/store/orders/{{order_id}} and the request type is GET
  4. In the authorization tab select type as “inherit auth from parent”.
  5. Click on Send.
  6. As soon as you click send, in the response tab, you should see the output.