Reputation: 1300
I'm having an issue when calling a GET REST (Regional) API which then invokes DynamoDB Scan API to get all the items of a table called City-Temperature.
As a request parameter, I'm adding only 'tablename' since it's required to call DynamoDB:Scan API. But on testing the API, I'm getting a 400 status from DynamoDB with error as follows:
{
"__type": "com.amazon.coral.validate#ValidationException",
"message": "1 validation error detected: Value null at 'tableName' failed to satisfy constraint: Member must not be null"
}
For simplicity, the dynamoDB table "City-Temperature" contains five items with each item 'City' (primary key - String) containing a single attribute (string) "Temperature".
My steps to generate API Service Proxy:
To add here: 'Request Body Passthrough' is set to 'When there are no templates defined (recommended)'
{
"tableName": "$input.params('tablename')"
}
Finally, in test section, I add tablename=City-Temperature as a query string to pass in table's name for Scan API and hit 'Test'. But an error as mentioned above is being thrown in response.
Update:
In logs, it looks like request body after transformation is being properly converted:
{ "tablename": "City-Temperature" }
. But yet, same error as above
Upvotes: 1
Views: 2709
Reputation: 2777
Based on https://aws.amazon.com/blogs/compute/using-amazon-api-gateway-as-a-proxy-for-dynamodb/, tableName
is not of attribute object type, but rather a simple string
. EDIT: also property should be pascal cased. Thus following change should do
{
"TableName":"$input.params('tablename')"
}
Upvotes: 3