Invoking a REST API in Amazon API Gateway
To call a deployed API, clients submit requests to the URL for the API Gateway component service
for API execution, known as execute-api
.
The base URL for REST APIs is in the following format:
https://
{restapi_id}
.execute-api.{region}
.amazonaws.com/{stage_name}
/
where {restapi_id}
is the API identifier,
{region}
is the Region, and
{stage_name}
is the stage name of the API deployment.
Important
Before you can invoke an API, you must deploy it in API Gateway. To do that, follow the instructions in Deploying a REST API in Amazon API Gateway.
Topics
Obtain an API's invoke URL in the API Gateway console
If an API permits anonymous access, you can use any web browser to invoke any
GET
method calls by copying and pasting an appropriate invocation URL
to the browser's address bar. For other methods or any authentication-required calls,
the invocation are more involved because you must specify a payload or sign the
requests. You can handle these in a script behind an HTML page or in a client
application using one of the AWS SDKs.
For testing, you can use the API Gateway console to call an API by using the API Gateway's
TestInvoke
feature, which bypasses the Invoke
URL and
allows API testing before the API is deployed. Alternatively, you can use the Postman
Note
Query string parameter values in an invocation URL cannot contain %%
.