调用 UpdateMethod 操作时出现 /methodIntegration/uri 的无效路径错误

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

我正在更新 AWS API 网关中的 API。这是我的 lambda 函数:

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://whosebug.com',
                        },
                    ]
                )

这工作正常并更新“API key required”字段,但是当我尝试更新“URI”字段时它抛出以下错误。 "errorMessage": "An error occurred (BadRequestException) when calling the UpdateMethod operation: Invalid patch path /methodIntegration/uri",

我觉得这条路不错。文档:https://docs.aws.amazon.com/cli/latest/reference/apigateway/update-method.html

apiKeyRequired 有效,因为它是 valid property of a method. To update integration you should use update-integration where uri is its valid property.