So I am trying to invoke our backend's API through AWS cli as it is shown in documentation (https://docs.aws.amazon.com/cli/latest/reference/apigateway/test-invoke-method.html):
# exalmple from the docs:
# aws apigateway test-invoke-method --rest-api-id 1234123412 --resource-id avl5sg8fw8 --http-method GET --path-with-query-string '/'
# my own call
aws apigateway test-invoke-method --rest-api-id ${restId} --resource-id ${resID} --http-method GET --path-with-query-string '/health'
However, it fails with :
An error occurred (NotFoundException) when calling the TestInvokeMethod operation: Invalid Method identifier specified
The error message is confusing and makes me think I don't know how to spell GET
. Any help with what's wrong?
Version
$ aws --version
aws-cli/2.15.15 Python/3.11.6 Darwin/23.3.0 exe/x86_64 prompt/off
Okey I misunderstood what resource-id
supposed to mean. I thought it identifies the whole API, and then I pass some route "/route" to call.
In fact, it identifies a single route, and this particular route which I was calling didn't have any http methods associated. So i need to use the resource-id of the route i want to invoke