I create a boto3 session and client for my aws apigateway like this:
self.b3_session = boto3.Session(profile_name="aaa", region_name = 'us-east-1')
self.api_gateway_client = self.b3_session.client('apigateway', region_name='us-east-1')
I then make a get_method call to my api gateway:
response = self.api_gateway_client.get_method(
restApiId='abcdefg123',
resourceId='123ab',
httpMethod='GET'
)
This is what I get back:
{
"apiKeyRequired": "False",
"httpMethod": "GET",
"methodIntegration": {
"integrationResponses": {
"200": {
"statusCode": "200"
}
},
"contentHandling": "CONVERT_TO_TEXT",
"timeoutInMillis": 29000,
"uri": "arn:aws:apigateway:us-east-1:lambda:path/.../invocations",
"httpMethod": "POST",
"passthroughBehavior": "WHEN_NO_MATCH",
"cacheNamespace": "abcdef",
"type": "AWS_PROXY",
"cacheKeyParameters": []
},
"methodResponses": {
"200": {
"responseModels": {
"application/json": "Empty"
},
"statusCode": "200"
}
},
"ResponseMetadata": {
"RetryAttempts": 0,
"HTTPStatusCode": 200,
"RequestId": "xxxxxxxx-xxxx-xxx-xxxx-xxxxxxxxxxxx",
"HTTPHeaders": {
"x-amzn-requestid": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"content-length": "611",
"x-amz-apigw-id": "xxxxxxxxxxxxxxxxx",
"connection": "keep-alive",
"date": "Wed, 06 Nov 2019 22:45:47 GMT",
"content-type": "application/json"
}
},
"authorizationType": "NONE"
}
I'm expecting a 'body' element with a list of names.
I'm able to get the intended response using the aws cli:
aws apigateway test-invoke-method --rest-api-id abcdefg123 --resource-id 123ab --http-method GET --path-with-query-string '/myfunction' --profile aaa --region us-east-1
What am I doing wrong? I couldn't find documentation for passing in the "path-with-query-string" parameter '/myfunction'. Is that the problem?
Is this is low level response and I need to follow a process to get my list of names? Thank you.
Edited by: milo333 on Nov 6, 2019 4:25 PM
Edited by: milo333 on Nov 6, 2019 4:29 PM
Edited by: milo333 on Nov 7, 2019 12:37 PM
Edited by: milo333 on Nov 7, 2019 12:47 PM