0% found this document useful (0 votes)
5 views

API_Gateway

The document provides an overview of APIs and the Amazon API Gateway, detailing their functionalities, types, and pricing. It explains how APIs facilitate communication between software components and describes the architecture and capabilities of the Amazon API Gateway, including support for REST, HTTP, and WebSocket APIs. Additionally, it includes practical steps for creating and testing a REST API using the Amazon API Gateway.
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

API_Gateway

The document provides an overview of APIs and the Amazon API Gateway, detailing their functionalities, types, and pricing. It explains how APIs facilitate communication between software components and describes the architecture and capabilities of the Amazon API Gateway, including support for REST, HTTP, and WebSocket APIs. Additionally, it includes practical steps for creating and testing a REST API using the Amazon API Gateway.
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 35

API and Amazon API Gateway

Contents
1. What is an API?
2. What is The Amazon API Gateway?
a. The Architecture of Amazon API Gateway
b. API Types Supported by API Gateway
• REST API
• HTTP APIs
• WebSocket APIs
c. Amazon API Gateway Pricing
3. Creating and Using a REST API with Amazon API Gateway

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


Create our first API with Amazon API Gateway in the tutorial, and then integrate
the API via HTTP with the “Pet Store website endpoints”.
Finally, we will run and test our API by using the “GET” method and observe the
response. We will do them practically and step by step.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


1. What is an API?
APIs (Application Programming Interface) are mechanisms that enable two
software components to communicate with each other using a set of definitions
and protocols.
Basically, APIs are a way for applications to communicate with each other across
the web through specific inputs and outputs. An API is a code that enables two
software programs to communicate.
An API defines how a developer should request services from an operating system
(OS) or other application, and expose data within different contexts and across
multiple channels. Any data can be shared with an application programming
interface.
For example, the weather bureau’s software system contains daily weather data.
The weather app on your phone “talks” to this system via APIs and shows you
daily weather updates on your phone.
Another example, on a real estate website, one API might publish available real
estate properties by geography, while a second API provides current interest rates
and a third offers a mortgage calculator.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


APIs act as the “front door” for applications to access data, business logic, or
functionality from your backend services, as shown

The following illustrations explain the API and its operation well

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


2. What is The Amazon API Gateway?
Amazon API Gateway is an AWS service for creating, publishing, maintaining,
monitoring, and securing REST, HTTP, and WebSocket APIs at any scale.
API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


It enables real-time two-way communication applications. API Gateway supports
containerized and serverless workloads, as well as web applications. API Gateway
handles all the tasks involved in accepting and processing up to hundreds of
thousands of concurrent API calls, including traffic management, CORS support,
authorization and access control, throttling, monitoring, and API version
management. API Gateway has no minimum fees or startup costs. You pay for the
API calls you receive and the amount of data transferred out and, with the API
Gateway tiered pricing model, you can reduce your cost as your API usage scales.

a. The Architecture of Amazon API Gateway


The following diagram shows API Gateway architecture,

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


This diagram illustrates how the APIs you build in Amazon API Gateway provide
you or your developer customers with an integrated and consistent developer
experience for building AWS serverless applications.
API Gateway handles all the tasks involved in accepting and processing up to
hundreds of thousands of concurrent API calls. These tasks include traffic
management, authorization and access control, monitoring, and API version
management.
API Gateway acts as a “front door” for applications to access data, business logic,
or functionality from your backend services, such as workloads running on
Amazon Elastic Compute Cloud (Amazon EC2), code running on AWS Lambda, any
web application, or real-time communication applications.
Amazon API Gateway has authentication mechanisms, such as AWS IAM policies,
Lambda authorizer functions, and Amazon Cognito user pools. Support for custom
domain names. It has integration with AWS WAF for protecting your APIs against
common web exploits, and also integration with AWS X-Ray for understanding and
triaging performance latencies.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


b. API Types Supported by API Gateway
Amazon API Gateway supports stateful (WebSocket) and stateless (HTTP and
REST) APIs

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


REST API

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


Representational State Transfer (REST) is a software architecture that implements
conditions on how an API should work. REST defines a set of functions like GET,
PUT, DELETE, etc. that clients can use to access server data. Clients and servers
exchange data using HTTP.
Web services that implement REST architecture are called RESTful web services.
The term RESTful API generally refers to RESTful web APIs. However, you can use
the terms REST API and RESTful API interchangeably.
REST APIs (Representational State Transfer Application Programming Interface) is a
data source’s frontend that allows users to create, retrieve, update, and delete
data items. A REST API is a set of HTTP-based standards that control how different
applications communicate with one another. There are 4 basic methods, which are

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


also referred to as CRUD operations; GET, POST, PUT, and DELETE,

HTTP protocol is unidirectional where the client sends the request and the server
sends the response (WebSockets is bidirectional communication).
Let’s take an example when a user sends a request to the server this request goes
in the form of HTTP or HTTPS, and after receiving a request server sends the
response to the client, each request is associated with a corresponding response,
and after sending the response the connection gets closed, each HTTP or HTTPS
request establish the new connection to the server every time and after getting
the response the connection gets terminated by itself.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


REST APIs:
API Gateway REST APIs use a request/response model where a client sends a
request to a service and the service responds back synchronously.
This kind of model is suitable for many different kinds of applications that depend
on synchronous communication.

Instagram API permits your applications to retrieve user tags, photos, account,
and much more.
Twitter also provides a REST API which a developer can query to source the latest
tweets, or provide a search query that will return the results in JSON format.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


GitHub also offers super REST API that you can utilize to perform actions such as
following GitHub issues, tracking user activity, and creating repositories from your
app.
Amazon API Gateway can create RESTful APIs that:
Enable stateless client-server communication.
Implement standard HTTP methods such as GET, POST, PUT, PATCH, and DELETE.

HTTP APIs
The HyperText Transfer Protocol (HTTP) is a method of transferring files such as
text, images, sound, video, and other multimedia files.
This protocol is used to link sites on the internet, often known as the World Wide
Web.
A Web API is a protocol that explains how clients can access resources and which
methods are compatible with your architecture.
These resources can be in the form of JavaScript or HTML elements, information,
or images, among other media kinds.
An HTTP API communicates between two systems using the Hypertext Transfer
Protocol.
HTTP APIs make endpoints available as API gateways, allowing HTTP queries to
connect to a server.
When you schedule a Zoom meeting on your Google calendar, for instance, you
utilize an HTTP API.
Instead of copying and pasting the meeting invitation into a field, the API explains
how Zoom may communicate directly with Google’s servers to embed a Zoom
meeting within the event.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


REST APIs and HTTP APIs are both RESTful API products.
REST APIs support more features than HTTP APIs, while HTTP APIs are designed
with minimal features so that they can be offered at a lower price.
You can use HTTP APIs to send requests to AWS Lambda functions or to any
routable HTTP endpoint.
For example, you can create an HTTP API that integrates with a Lambda function
on the backend.
When a client calls your API, API Gateway sends the request to the Lambda
function and returns the function’s response to the client.

HTTP APIs enable you to create RESTful APIs with lower latency and lower cost
than REST APIs. You can use HTTP APIs to send requests to AWS Lambda functions
or to any publicly routable HTTP endpoint.
For example, you can create an HTTP API that integrates with a Lambda function
on the backend.
When a client calls your API, API Gateway sends the request to the Lambda
function and returns the function’s response to the client.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


WebSocket APIs
WebSocket is a protocol providing full-duplex communications channels over a
single TCP connection.
It enables simultaneous two-way communication (full-duplex communication)
between the client and the server over a single connection.
The WebSocket API is an advanced technology that makes it possible to open a
two-way interactive communication session between the user’s browser and a
server.
With this API, you can send messages to a server and receive event-driven
responses without having to poll the server for a reply.

In API Gateway you can create a WebSocket API as a stateful frontend for an AWS
service (such as Lambda or DynamoDB) or for an HTTP endpoint.
The WebSocket API invokes your backend based on the content of the messages it
receives from client apps.
Unlike a REST API, which receives and responds to requests, a WebSocket API
supports two-way communication between client apps and your backend.
The backend can send callback messages to connected clients.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


Every API has a URL. API of type REST uses HTTP protocol.
So, they start with http:// or https://. Similarly, websockets also have URLs and
they start with ws:// or wss://, as seen in the example below.
const [webSocket, setWebSocket] = useState(null);

useEffect(() => {
const ws = new WebSocket(
`wss://your-websocket-server.com`
);
setWebSocket(ws);
...

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


WebSockets enable bidirectional communication (HTTP protocol was a
unidirectional protocol) between a client and server, enabling real-time data
transmission.
It is a stateful protocol, which means the connection between client and server
will keep alive until it is terminated by either party (client or server). After closing
the connection by either of the client and server, the connection is terminated
from both ends.
This is useful for applications that require continuous data updates, such as real-
time monitoring of sensor data and displaying live dashboards.
For example, you could use a WebSocket API to continuously monitor the
temperature in a room over a persistent connection.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


Almost all real-time applications like (trading, monitoring, notification) services
use WebSocket to receive the data on a single communication channel. All the
frequently updated applications use WebSocket because it is faster than HTTP
Connection.

API Gateway creates WebSocket APIs that:


Adhere to the WebSocket protocol, which enables stateful, full-duplex
communication between client and server.
Route incoming messages based on message content.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


In a WebSocket API, the client and the server can both send messages to each
other at any time. Backend servers can easily push data to connected users and
devices, avoiding the need to implement complex polling mechanisms.
For example, you could build a serverless application using an API Gateway
WebSocket API and AWS Lambda to send and receive messages to and from
individual users or groups of users in a chat room. Or you could invoke backend
services such as AWS Lambda, Amazon Kinesis, or an HTTP endpoint based on
message content.

WebSocket API be use cases:


Real-time web application: Real-time web application uses a web socket to show
the data at the client end, which is continuously being sent by the backend server.
In WebSocket, data is continuously pushed/transmitted into the same connection
which is already open, that is why WebSocket is faster and improves the
application performance.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


For e.g. in a trading website or bitcoin trading, for displaying the price fluctuation
and movement data is continuously pushed by the backend server to the client
end by using a WebSocket channel.
Gaming application: In a Gaming application, you might focus on that, data is
continuously received by the server, and without refreshing the UI, it will take
effect on the screen, UI gets automatically refreshed without even establishing the
new connection, so it is very helpful in a Gaming application.
Chat application: Chat applications use WebSockets to establish the connection
only once for exchange, publishing, and broadcasting the message among the
subscribers. It reuses the same WebSocket connection, for sending and receiving
the message and for one-to-one message transfer.

C. Amazon API Gateway Pricing:


With Amazon API Gateway, you only pay when your APIs are in use. There are no
minimum fees or upfront commitments.
For HTTP APIs and REST APIs, you pay only for the API calls you receive and the
amount of data transferred out.
There are no data transfer out charges for Private APIs. However, AWS PrivateLink
charges apply when using Private APIs in API Gateway. For WebSocket APIs, you
only pay when your APIs are in use based on number of messages sent and
received and connection minutes.
The API Gateway free tier includes one million HTTP API calls, one million REST API
calls, one million messages, and 750,000 connection minutes per month for up to
12 months.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


Creating and Using a REST API with Amazon API Gateway
We will create our first API with Amazon API Gateway. The API will integrate via
HTTP with the “Pet Store endpoints”.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


The PetStore example API supports the following methods for a client to
access the HTTP backend website of http://petstore-demo-

endpoint.execute-api.com/petstore/pets. (30)

 GET /: for read access of the API's root resource that is not
integrated with any backend endpoint. API Gateway responds with
an overview of the PetStore website.

 GET /pets: for read access to the API's /pets resource


that is integrated with the like-named
backend /pets resource.

 POST /pets: for write access to the API's /pets resource that is
integrated with the backend /petstore/pets resource.

 GET /pets/{petId}: for read access to a pet as identified


by a petId value as specified as a path variable of the incoming
request URL.

 Now, in order to create our first API, sign in to the API Gateway
console
at https://console.aws.amazon.com/apigateway, and
then Under REST API, choose Build, as shown in Figure …

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


Note: If this is your first time using API Gateway, you see a page that introduces
you to the features of the service.

When the Create Example API popup appears, choose OK

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


Under Choose the protocol, choose “ REST”, and then under Create new API,
choose “Example API” and then choose “Import” to create the example API.
Note: For your first API, the API Gateway console starts with this option as default.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


The newly created API is shown in Figures

The Resources pane shows the structure of the created API as a tree of nodes. API
methods defined on each resource are edges of the tree. When a resource is
selected, all of its methods are listed in the Methods pane on the right. Displayed

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


under each method is a brief summary of the method, including its endpoint URL,
authorization type, and API Key requirement.

For example, here, I chose the POST /pets method as an illustration.

Choose “Test” shown in the Client section to start testing,

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


For example, to test the POST /pets method, enter the following {"type":
"dog","price": 249.99} payload into the Request Body, after that, choose
the “Test” button, as shown in Figure.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


The input specifies the attributes of the pet that we want to add to the list of pets
on the PetStore website. The results are displayed, as shown in Figure.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


To deploy our sample API, choose “Deploy API” from the Actions menu in the
PetStore API, as shown in Figure

In Deploy API, for Deployment stage, choose “New Stage” because this is the first
deployment of the API. Type a name (e.g., I typed pet-store) in Stage name and,
optionally, type descriptions in Stage description and Deployment description.

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


Choose Deploy, as shown in figure.

In the resulting Stage Editor pane, Invoke URL displays the URL to invoke the API’s
GET / method request, as shown in Figure

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


When we click the “Invoke URL”, the result of “the API’s GET / method request”
appears in the browser. A successful response returns the result, as shown in
Figure

n the Stages navigation pane, expand the test stage, select GET on /pets/{petId},
and then copy the Invoke URL value of https://api-id.execute-
api.region.amazonaws.com/test/pets/{petId}. {petId} stands for a path variable, as
shown in Figure

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS


Paste the “Invoke URL” value inFigure 27 into the address bar of a browser, replace
{petId}, for example, 1, and press Enter to submit the request. A 200 OK response
should return with the JSON format, as shown in Figure,

Note: Invoking the API method without any authorization settings is possible
because we set “Authorization type” to “NONE” before. For this, In the GET
method’s Method Execution pane, we can choose Method Request; as AWS_IAM
or Cognito for Authorization.
API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

API GATEWAY SUDHAKARA RAO .C/CLOUD SOLUTIONS

You might also like