0

I'm trying to run the following code to write into dynamodb via a POST method but getting an error:

{
    "httpMethod":"POST",
    "body": {
        "TableName":"LamdaTest",
        "Item":{
            "ID":"1",
            "Name":"Foobar"

        }
    }
}

ERROR MESSAGE:

Parameter validation failed: Invalid type for parameter Item.ID, value: 1, type: <class 'str'>, valid types: <class 'dict'>\nInvalid type for parameter Item.Name, value: Foobar, type: <class 'str'>, valid types: <class 'dict'>",
Roman Pokrovskij
  • 9,449
  • 21
  • 87
  • 142
Nadeem
  • 17
  • 9

1 Answers1

0

Try passing it like this, as a dictionary (from the docs):

{
    "httpMethod":"POST",
    "body": {
        TableName="LamdaTest",
        Item={
            "ID": {"N":"1"},
            "Name": {"S":"Foobar"}
        }
    }
}