BadRequestException when having API gateway call BatchPutItem in DynamoDB directly

I have a yml file that works flawlessly to provision an identity pool, user pool and cognito.

I want to have where I can call an API service and have it put that data directly into DynamoDB without a lambda.

I get this error:

An error occurred: EventsDeployment - The REST API doesn’t contain any methods (Service: AmazonApiGateway; Status Code: 400; Error Code: BadRequestException; Request ID: bdee0426-532e-43f1-b2dd-76fa463eff0c; Proxy: null).

This happens whenever I use this block of code in my file. I am thinking the uri may be the cause, but I am not certain.

I am not certain what I did wrong.

I am using frameworkVersion: ‘2’ and I don’t know if that is my issue.

EventsDeployment:
Type: AWS::ApiGateway::Deployment
Properties:
RestApiId:
Ref: ApiGatewayRestApi
StageName: ${self:provider.stage}
EventsAPI:
Type: AWS::ApiGateway::Method
Properties:
RestApiId:
Ref: ApiGatewayRestApi
ResourceId:
Ref: EventsResource
OperationName: ‘AddEvents’
AuthorizerId:
Ref: APIAuthorizer
AuthorizationType: COGNITO_USER_POOLS
HttpMethod: POST
Integration:
Type: AWS
IntegrationHttpMethod: POST
Uri: arn:aws:apigateway:us-east-1:dynamodb:action/BatchWriteItem
Credentials:
Fn::GetAtt: [ApiGatewayDynamoRole, Arn]
PassthroughBehavior: NEVER
RequestTemplates:
application/json: |
#set($inputRoot = $input.path(‘$’))
{
“RequestItems”: {
“${self:resources.Resources.EventsTable.Properties.TableName}”: [
#foreach($event in $inputRoot.event)
{
“PutRequest”: {
“Item”: {
“UserID” : { “S”: “$context.authorizer.claims.sub” },
“TimeUTC” : { “S”: “$event.time” },
“Lat”: { “N”: “$event.lat” },
“Lng”: { “N”: “$event.lng” },
“UUID” : { “S”: “$event.uuid”},
“Sensor” : { “S”: “$event.sensor_name” },
“Reading” : { “N”: “$event.reading_value” },
“Active” : { “BOOL”: “$event.is_active” },
}
}
}#if($foreach.hasNext),#end
#end
]
},
“ReturnConsumedCapacity”: “NONE”,
“ReturnItemCollectionMetrics”: “NONE”
}
IntegrationResponses:
- StatusCode: ‘200’
SelectionPattern: “2\d{2}”
ResponseParameters:
method.response.header.Access-Control-Allow-Origin: “‘‘"
ResponseTemplates:
application/json: ‘{}’
- StatusCode: ‘400’
SelectionPattern: “4\d{2}”
ResponseParameters:
method.response.header.Access-Control-Allow-Origin: "’
’”
MethodResponses:
- StatusCode: ‘200’
ResponseParameters:
method.response.header.Access-Control-Allow-Origin: true
ResponseModels:
application/json: Empty
- StatusCode: ‘400’
ResponseParameters:
method.response.header.Access-Control-Allow-Origin: true
ResponseModels:
application/json: Error