Testing API using Postman

Objective

Test the API Gateway REST endpoint integrated with the Lambda Function to verify the data operations performed on DynamoDB.


Download and install Postman before starting this section.


1. Update Authorization Settings

  • Go to AWS Console → API Gateway
  • Select FlyoraAPI
  • Navigate to
    /api/v1/{myProxy+} → ANY → Method request → Edit

POST_5

  • Set Authorization to AWS_IAM(Note: Only enable when testing with Postman, then remember to turn it off afterwards)

POST_6


2. Create an Access Key

  • Go to AWS Console → IAM → Users
  • Click Create User

POST_8

  • Set username: test

POST_7

  • Confirm user creation

POST_9

  • Open the test user → Security credentials → Create access key

POST_10

  • Choose Local code

POST_11

  • Copy the Access key and Secret access key

POST_12


Testing GET Request

  • Open Postman

  • Choose GET

  • Enter URL:https://<api_id>.execute-api.ap-southeast-1.amazonaws.com/dev/api/v1/reviews/product/1

  • Headers tab:

    • Key: Content-Type | Value: application/json
  • Authorization tab:

    • Type: AWS Signature
    • Enter AccessKey
    • Enter SecretKey
    • AWS Region: ap-southeast-1
    • Service Name: execute-api
  • Click Send

  • Result: Returns the list of Items from the reviews table.

POST_13


Testing POST Request

  • Choose POST

  • URL:https://<api_id>.execute-api.ap-southeast-1.amazonaws.com/dev/api/v1/reviews/submit

  • Body → raw → JSON

    {
      "customerId": 2,
      "rating": 4,
      "comment": "Chim ăn ngon và vui vẻ!",
      "customerName": "Nguyễn Văn B"
    }
    
  • Click Send

  • Result: Inserts a new Item into the Review table.