Skip to content
Advertisement

when calling the UpdateMethod operation getting invalid path error for /methodIntegration/uri

I’m updating an API in AWS API Gateway. This is my lambda function:

response = client.update_method(
                    restApiId=rest_api_id,
                    resourceId=resource_id,
                    httpMethod= "GET", #method
                    patchOperations=[
                        {
                            'op': 'replace',
                            # 'path': '/apiKeyRequired',
                            # 'value': 'true',
                            'path': '/methodIntegration/uri',
                            'value': 'https://stackoverflow.com',
                        },
                    ]
                )

This works fine and updates “API key required” field, but when I try to update the “URI” field it throws the following error. "errorMessage": "An error occurred (BadRequestException) when calling the UpdateMethod operation: Invalid patch path /methodIntegration/uri",

The path looks fine to me. Docs: https://docs.aws.amazon.com/cli/latest/reference/apigateway/update-method.html

Advertisement

Answer

apiKeyRequired works because it is a valid property of a method. To update integration you should use update-integration where uri is its valid property.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement