0

I have a PUT API Gateway endpoint which should be used to update a DynamoDB entry.

The id for that DynamoDB entry is given as the path parameter.

I have the following mapping template:

"application/json": {
    "id": "$input.params('id')",
    "title": "$input.json('$.title')"
}

The id is returned as expected.

If I submit this request body

{
  "title": "Hello world" 
}

I get the error Could not parse request body into json: Unexpected character (\'t\'

Here's the overview of my AWS management console:

enter image description here

what am I missing?

1 Answer 1

1

So I just found the solution:

"title": "$input.json('$.title')"

should be

"title": $input.json('$.title') (without the double quotes).

Source: http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#input-variable-reference

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.