1
What is an API?
● API stands for Application Programming Interface.
● It is a set of rules and protocols that allow different software
applications to communicate with each other.
● APIs define how requests and responses are structured
between systems.
● Examples:
○ When you log in to a website using Google or Facebook, that
site is using an API provided by Google/Facebook.
○ Payment gateways like PayPal or Stripe expose APIs to
integrate payment processing into websites.
1. Business Side APIs
From a business perspective, APIs are categorized based on who can
use them and for what purpose:
a) Public APIs (Open APIs)
● Accessible to any developer or business.
● Often provided by companies to encourage adoption and
integration.
2
● Examples: Google Maps API, Twitter API.
● Use case: Extending brand reach, enabling third-party innovation.
b) Private APIs
● Used internally within a company.
● Not exposed to external developers.
● Helps different teams or systems within the company integrate.
● Example: An internal HR system connecting with payroll.
● Use case: Improve internal efficiency, maintain security.
c) Partner APIs
● Shared with specific business partners only.
● Requires special access rights.
● Example: A travel website integrating directly with airline APIs
under partnership agreements.
● Use case: Build secure, value-driven business collaborations.
d) Composite APIs
3
● Combine multiple APIs into a single call.
● Useful when a user or system needs data from different sources at
once.
● Example: A mobile banking app fetching account details,
transaction history, and credit score in one request.
● Use case: Reduce latency, improve efficiency, enhance user
experience.
2. Technical Side APIs
From a technical perspective, APIs can be categorized by design and
implementation:
a) REST (Representational State Transfer)
● The most common style uses HTTP methods (GET, POST, PUT,
DELETE).
● Data typically exchanged in JSON or XML.
● Example: GET [Link]
b) SOAP (Simple Object Access Protocol)
● Older, more rigid protocol.
● Uses XML for messaging.
4
● Strong focus on security and reliability.
● Example: Used in financial services and enterprise applications.
c) GraphQL
● A query language for APIs developed by Facebook.
● Allows clients to request only the data they need.
● Example: Querying a social media feed where you fetch only user
names and profile pictures.
d) gRPC (Google Remote Procedure Call)
● Uses Protocol Buffers for fast communication.
● Works well for microservices and real-time systems.
4. How to Make an API Call
An API call is when you send a request to an API endpoint and receive a
response.
General Steps:
1. Identify the API endpoint (URL)
5
○ Example:
[Link]
2. Choose the HTTP method
○ GET: Retrieve data
○ POST: Send data
○ PUT/PATCH: Update data
○ DELETE: Remove data
3. Provide necessary headers
○ Example: Authentication tokens, content type
(application/json).
4. Send request with parameters
Example (GET request with query parameters):
GET
[Link]
n&appid=YOUR_API_KEY
○
5. Receive the response
6
○ Usually in JSON or XML format.
Example JSON response from weather API:
{
"weather": [
{"description": "clear sky"}
],
"main": {
"temp": 293.15
},
"name": "London"
}
○
6. Parse and use the data in your application.