Using Postman

Postman is a popular tool used to test APIs. Follow the steps below to test your deployed API:

  1. Open Postman: Make sure you followed section 2. Preparation Steps to download and install Postman. If you have already downloaded and installed it, open it.

  2. Create New Request: Click Blank collection, name your new collection.

  3. Set the URL: In the URL field, copy the Invoke URL from your deployed API Gateway. For example: https://<your-api-id>.execute-api.<region>.amazonaws.com/<stage>/<endpoint>

S3

  1. Show product list:
  • Select the GET method.

  • Paste the copied URL and add /products.

  • Click Send.

  • Result: Display product list (currently no products)

S3

  1. Add a new product:
  • Select the POST method.

  • Paste the copied URL and add /products.

  • Navigate to Body, select raw and select JSON.

  • Fill in product information:

{  
    "id": "101",
    "name": "Laptop Levono",
    "price": "50000",
}
  • Click Send.

  • Result: Displays a message that the new product was successfully added.

S3

  • Continue adding new products:
{  
    "id": "102",
    "name": "Laptop HP",
    "price": "35000",
}
  • Result: Displays a message that the new product was successfully added.

S3

  • Display product list after adding: do the same as step 4.

S3

  1. Get product information by ID:
  • Select the GET method.

  • Paste the copied URL and add /product?id={id}.

  • Click Send.

  • Result: Display product information by ID.

S3

  1. Update product information:
  • Select the PUT method.

  • Paste the copied URL and add /product?id={id}.

  • Navigate to Body, select raw and select JSON.

  • Edit product information:

{  
    "id": "102",
    "name": "Laptop HP",
    "price": "35000",
}
  • Click Send.

  • Result: Displays a message that the product has been successfully updated.

S3

  • Display product list after update: do the same as step 4.

S3

  1. Delete product information:
  • Select the DELETE method.

  • Paste the copied URL and add /product?id={id}.

  • Click Send.

  • Result: Displays a message that the product has been successfully deleted.

S3

  • Display product list after deletion: do the same as step 4.

S3

  1. We have completed testing the results using Postman. Next we will test the results using the website hosted on S3.