A common thread when working with API Gateway CLI commands is the need for a REST API ID and a resource ID. Fortunately, these two pieces of information are easy to find as long as you know where to look. Select the / entry in the Resource Tree.
At the top of the page, you see the following:
APIs > PetStore (17kbeo12d7) > Resources > / (4al7ycfwb6)
The 17kbeo12d7
entry is the value you supply to the --rest-api-id
argument when making calls. You need this value to make most of the calls. The 4al7ycfwb6
entry is the value you supply to the --resource-id
argument when requested. This second value sees use only with specific calls.
The various CLI calls for API Gateway, and as you can see, there are many of them. Some calls output text, which you can display directly in the command prompt or terminal window; others output HTML or some other format that doesn’t display well at the command prompt. To see one of the former commands in action, type aws apigateway get-rest-api --rest-api-id 17kbeo12d7 and press Enter. Remember to replace the --rest-api-id
argument with the value for your example API.
This output looks fine in the command window. However, if you want to obtain information about an existing method resource, you need some means to display HTML as output. To create the HTML output, type aws apigateway get-method --rest-api-id 17kbeo12d7 --resource-id 4al7ycfwb6 --http-method GET > Output.html and press Enter.
You must replace both the --rest-api-id
and --resource-id
entries with values from your example API. In addition, the redirection used for this example is for Windows. Make sure that you redirect the output using the redirection for your platform. After you execute the command, load the resulting file in your browser.