1
4
2
5
3
7
6
API = ApplicationProgramming Interface
What is an API?
It’s a bridge that allows two applications to communicate.
Example:
●When you log in with Google Your app uses Google’s API
→
to authenticate you.
Visual: Diagram showing two apps talking via an API.
8
9
2
4
1
5
3
7
6
8
9
Why APIs Matter
●Enable integration between systems
● Encourage reusability of code
● Support automation and scalability
●Power modern apps: mobile, web, IoT, AI, etc.
Example:
Uber uses APIs for maps, payments, and messaging.
3
4
1
5
2
7
6
Types of APIs
8
9
TypeDescription Example
RESTful Uses HTTP and resources (URLs). GET /users
GraphQL Query language for APIs; fetch only what
you need.
{ user { name,
email } }
SOAP XML-based; strict protocol. <soap:Envelope>
WebSocket Real-time communication. Chat apps
gRPC Uses Protocol Buffers for fast
communication.
Microservices
8.
RESTful APIs –The Standard
Core Ideas:
●Stateless communication
● Uses HTTP methods
●Returns data (usually JSON)
●Resource-based URLs
GET https://api.example.com/users
POST https://api.example.com/users
4
3
1
5
2
7
6
8
9
6
3
1
4
2
7
5
HTTP Status Codes
8
9
CodeMeaning Example
200 OK – Request successful ✅
201 Created – New resource made 🆕
400 Bad Request – Invalid input ⚠️
401 Unauthorized – Need credentials 🔒
404 Not Found – Resource missing ❓
500 Server Error – API issue 💥
11.
7
3
1
4
2
6
5
8
9
Postman – YourAPI Playground
Postman lets you:
●Send and test HTTP requests
●Automate tests and collections
●Document your APIs
●Simulate environments
9
3
1
4
2
6
5
7
8
Create an endpointfor your app
Example scenario: Student registration system
POST /api/students Add student
→
GET /api/students Get all students
→
GET /api/students/{id} Get specific student
→
PUT /api/students/{id} Update student info
→
DELETE /api/students/{id} Remove student
→
Building a Custom API Endpoint
15.
9
3
1
4
2
6
5
7
8
●Use clear, descriptiveendpoints
●Return consistent JSON responses
●Include proper status codes
●Document your API
(Swagger / Postman Docs)
●Version your API: /api/v1/
Tips for Designing Good APIs
16.
9
3
1
4
2
6
5
7
8
GraphQL vs REST
FeatureREST GraphQL
Data Fetching Multiple endpoints Single endpoint
Response Size Fixed Flexible
Caching Simple Complex
Use Case Simpler apps Dynamic queries