Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updateing aws apigateway binaryMediaTypes

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?

like image 551
SCNessen Avatar asked Aug 11 '26 02:08

SCNessen


1 Answers

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'"
like image 156
Bob Kinney Avatar answered Aug 14 '26 00:08

Bob Kinney



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!