129
Views
8
Comments
[Amazon DynamoDB Connector] Item Get Action, how to send the Key value
Question
amazon-dynamodb-connector
Service icon
Forge asset by Guilherme Pereira

Hi,

Can u give me example for Item_Get action,

I am struggling to pass the input parameter (Key)

the description have this info

Syntax-editor Code Snippet

Value for the primary key. This should be a json that serializes do a object of type Dictionary<string, AttributeValue>
UserImage.jpg
David Silvestre

Keerthi Vasan wrote:

Hi,

Can u give me example for Item_Get action,

I am struggling to pass the input parameter (Key)

the description have this info

Syntax-editor Code Snippet

Value for the primary key. This should be a json that serializes do a object of type Dictionary<string, AttributeValue>

Hi Keerthi you need to pass a json with of type Dictionary<string, AttributeValue> in my case my dynamodb table has a key called searchid which is a string so I pass the following json:

{"searchid": {"S": "321"}}


you can get more information on the attributevalue here https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Get.html


2026-02-19 02-54-36
Keerthi Vasan V

I dont aware that much of passing the Json,

But let me explain what i did.

I have created a local structure


and i am assigning the values

UserId  is the Key which is a string which i have created in DynamoDb fo testing purpose





I am getting this error



I think i made some mistakes in JSON, 


the following is the table and the elements

UserImage.jpg
David Silvestre

Hi Keerthi 

The problem is with your structure it won't serialize into the json format that the dynamodb is expecting, I made an example on how you should create your structures




2026-02-19 02-54-36
Keerthi Vasan V

Thanks for the Guide,


Getting another error


I think i need to add attribute value, but what is that attribute value?


UserImage.jpg
David Silvestre

can you debug and share the Json that is serialized 

2026-02-19 02-54-36
Keerthi Vasan V

2026-02-19 02-54-36
Keerthi Vasan V

I found the mistake .. 

I rectified 


I got the response 



How can i make this as a output structure?

Will De serializing automatically create the structure or should we need to define?

UserImage.jpg
Charles Hewitt

If your DynamoDB has both a Primary Partition Key and a Primary Sort Key you MUST use BOTH keys in the GetItem something like:

For Example: If my Primary Key is ec2 and the sort key is eu-west-2:

"{""myprimarykey"": {""S"":""ec2""}, ""mysortkey"":{""S"": ""eu-west-2""}}"

This was helpful:

https://stackoverflow.com/questions/42757872/the-provided-key-element-does-not-match-the-schema-error-when-getting-an-item

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.