APPLICATION
PROGRAMMING INTERFACE
(API)
PRESENTED BY :
MG MIN KHANT KYAW (4CS-5)
DATE : 22.1.2025
WHAT IS AN API ?
• API Stands for Application Programming Interface.
• Developers use APIs to bridge the gaps between two
applications.
• APIs can be used for :
• Communication between services.
• Example: Bank Transactions through third party apps.
• Access inbuilt hardware of a device.
• Example: access camera in a mobile.
HOW DO API WORK ?
• APIs work by sharing data between applications, systems and
devices.
• Client sends a request through the API and after performing
the action the API will send back a response to the client.
HOW DO API WORK ?
CONT..
1. API Client - The API client is responsible for starting the conversation by
sending the request to the API server. The request can be triggered in
many ways.
2. API Request- An API request will look and behave differently depending on
the type of API, but it will typically include the following components:
• Endpoint : An API endpoint is a dedicated URL that provides access to a specific
resource.
• Method : The request's method indicates the type of operation the client would like to
perform on a given resource.
• Parameters : Parameters are the variables that are passed to an API endpoint to
provide specific instructions for the API to process.
• Request headers :Request headers are key-value pairs that provide extra details
about the request.
• Request body :The body is the main part of the request, and it includes the actual
data that is required to create, update, or delete a resource.
HOW DO API WORK ?
CONT..
3. API Server- The API client sends the request to the API server,
which is responsible for handling authentication, validating input
data, and retrieving or manipulating data.
4. API Response- Finally, the API server sends a response to the
client. The API response typically includes the following
components:
• Status code: HTTP status codes are three-digit codes that indicate the
outcome of an API request.(E.g., 200 OK, 201 Created, 404 Not Found )
• Response headers : HTTP response headers are very similar to request
headers, except they are used to provide additional information about
the server's response.
• Response body : The response body includes the actual data or content
the client asked for—or an error message if something went wrong.
WHAT ARE THE BENEFITS OF THE API?
• Automation: APIs can be used to automate repetitive, time consuming work so that
humans can focus on more complex tasks. This improves productivity, especially for
developers and testers.
• Innovation: Public APIs can be used by external engineering teams, which spurs
innovation and accelerates development by enabling developers to repurpose
existing functionality to create new digital experiences.
• Security: APIs can provide an additional layer of protection against unauthorized
breaches by requiring authentication and authorization for any request to access
sensitive data.
• Cost efficiency: APIs provide access to useful third-party tools and infrastructure,
which helps businesses avoid the expense of building complex in-house systems.
WHAT ARE THE MOST COMMON API
ARCHITECTURAL STYLES?
• There are many API architectural styles, including REST, SOAP,
GraphQL, gRPC, WebSockets, and Webhooks. Each style has unique
characteristics and tradeoffs, and is used for different purposes.
1. REST (REpresentational State Transfer) - is the most popular
API architecture for transferring data over the internet. Uses
standard HTTP methods (GET, POST, PUT, DELETE) to perform
operations on resources identified by URLs
2. SOAP(Simple Object Access Protocol) - uses XML to transfer highly
structured messages between a client and server.
3. GraphQL - allows clients to retrieve just the data they need in a
structured way. It reduces over-fetching by enabling clients to
define the shape of the returned data using a query language.
API SECURITY
• Methods to Secure APIs
1. Authentication
• API Keys :A unique identifier used to authenticate requests.
• Oauth 2.0:Provides token-based access and is widely used in modern
APIs (e.g., “Sign in with Google”).
• JWT(JSON Web Token) : Issue tokens to authenticate users.
2. Authorization
• Ensure the user or application has the necessary permission to access a
resource. Tools like JWT (JSON Web Tokens) are often used for
authorization.
3. Encryption
• Use HTTPS (SSL/TLS) to encrypt data in transit, preventing interception.
HOW TO CREATE PRIVATE API ?
• Steps to create a Private API
• Plan and design your API
• Develop your API
• Secure your API
• Deploy your API
• Document your API
THANK YOU