Bird
0
0

Which of the following is the correct way to define a GET method in API Gateway to fetch an item from DynamoDB?

easy📝 Syntax Q12 of 15
DynamoDB - with Serverless
Which of the following is the correct way to define a GET method in API Gateway to fetch an item from DynamoDB?
AUse HTTP GET with a path parameter for the key and integrate with DynamoDB GetItem action
BUse HTTP POST with a JSON body containing the key and integrate with DynamoDB PutItem action
CUse HTTP DELETE with query parameters and integrate with DynamoDB DeleteItem action
DUse HTTP PUT with path parameters and integrate with DynamoDB UpdateItem action
Step-by-Step Solution
Solution:
  1. Step 1: Match HTTP method to DynamoDB action

    GET method is used to retrieve data, so it should map to DynamoDB's GetItem action.
  2. Step 2: Use path parameter for key

    The key identifying the item is passed as a path parameter in the GET request.
  3. Final Answer:

    Use HTTP GET with a path parameter for the key and integrate with DynamoDB GetItem action -> Option A
  4. Quick Check:

    GET + path key = GetItem [OK]
Quick Trick: GET method fetches data; use path parameter for key [OK]
Common Mistakes:
MISTAKES
  • Using POST instead of GET for fetching
  • Confusing PutItem with GetItem
  • Using wrong HTTP methods for actions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More DynamoDB Quizzes