I'm attempting to configure and update the binary support options of an AWS API Gateway. I can do this through the web UI without issue, but I would like to script this.
Using the CLI Command Reference pages: http://docs.aws.amazon.com/cli/latest/reference/apigateway/get-rest-api.html http://docs.aws.amazon.com/cli/latest/reference/apigateway/update-rest-api.html
Able to issue a get-rest-api command just fine:
C:\> aws apigateway get-rest-api --rest-api-id [ID]
{
"id": "[ID]",
"createdDate": 1490723884,
"name": "testbinarymediatypes"
}
But when attempting to update the binaryMediaTypes:
PS C:\> aws apigateway update-rest-api --rest-api-id [ID] --patch-operations op=add,path=binaryMediaTypes,value='image/jpg'
An error occurred (BadRequestException) when calling the UpdateRestApi operation: Invalid patch path binaryMediaTypes
Can this be done or am I stuck manually adding the types in the web UI every time?
The format for adding these via the CLI is a little non-intuitive.
aws apigateway update-rest-api --rest-api-id [ID]
--patch-operations "op=add,path=/binaryMediaTypes/image~1jpg"
aws apigateway update-rest-api --rest-api-id [ID]
--patch-operations "op=replace,path=/binaryMediaTypes/image~1jpg,value='image/gif'"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With