Home > Blockchain >  BadRequestException in AWS CLI when trying to import a swagger.json file
BadRequestException in AWS CLI when trying to import a swagger.json file

Time:09-23

I'm working on AWS API Gateway and trying to import a Swagger JSON file using AWS CLI. Following is the command I used to import.

aws apigateway import-rest-api --parameters endpointConfigurationTypes=REGIONAL  --cli-binary-format raw-in-base64-out --body D:/aws/test.json --no-fail-on-warnings

But I'm getting this error "An error occurred (BadRequestException) when calling the ImportRestApi operation: Invalid OpenAPI input."

The test.json is looked fine, I tried it in the AWS console and it was working. I don't understand why it is not working when I try to use AWS CLI. I'm using AWS CLI version 2. Any help would be much appreciated. Thanks

CodePudding user response:

You should be using file:// as explained in the docs:

--body file://C:\aws\test.json 
  • Related