Learn the words first
Start with API, REST, endpoint, request, response, JSON, and status codes so the later sections feel easy instead of abstract.
REST API Learning Hub
Learn REST APIs in baby steps with real-world examples, endpoint practice, testing labs, interview questions, and challenges.
First Learning Roadmap
Use this order if you are starting from zero and want the fastest route from confusion to confident practice.
Start with API, REST, endpoint, request, response, JSON, and status codes so the later sections feel easy instead of abstract.
Compare a GET, POST, PUT, PATCH, and DELETE side by side so you can see what changes in the URL, headers, body, and response.
Use the simulated API Lab to send your own requests without touching real production data or needing a complicated setup.
Use the challenge cards, quiz, and interview questions to turn memorized ideas into confident explanations.
Why REST API Matters
REST API understanding is useful for product work, integrations, debugging, analytics, AdTech operations, and technical interviews.
Frontends, servers, databases, analytics tools, and ad platforms all rely on APIs to exchange data.
Login flows, profile pages, order creation, reporting, campaign updates, and dashboards all run through API calls.
Developers, TAMs, support teams, solution engineers, and AdTech teams all need to read requests and debug responses.
Understanding 401, 404, 409, CORS, bad JSON, and slow queries is part of real production support.
REST API In Baby Steps
Simple meaning: A way for one system to ask another system for data or actions.
Easy analogy: A waiter between you and the kitchen.
GET /api/v1/lab-playground.php?resource=users&id=101
Simple meaning: A common way to design APIs around resources like users, orders, or campaigns.
Easy analogy: Labeled folders with clear actions.
GET /users
PATCH /users/42
Simple meaning: The exact URL you call.
Easy analogy: An apartment number, not just the building.
GET /api/v1/lab-playground.php?resource=users&id=102
Simple meaning: The method, URL, headers, query params, and body sent by the client.
Easy analogy: A full order slip.
{
"method": "POST",
"url": "/api/v1/lab-playground.php?resource=users"
}
Simple meaning: The status code, headers, and data returned by the server.
Easy analogy: The tray coming back from the kitchen.
{
"status": 201,
"data": {"id": 7}
}
Simple meaning: A simple text format for structured data.
Easy analogy: A labeled packing list.
{
"id": 1,
"name": "Ava"
}
Simple meaning: GET reads, POST creates, PUT replaces, PATCH updates part, DELETE removes.
Easy analogy: Different buttons for different actions.
GET /users
POST /users
DELETE /users/9
Simple meaning: Extra request instructions like auth and content type.
Easy analogy: Sticky notes on the package.
Content-Type: application/json
Authorization: Bearer token
Simple meaning: Extra filters after the URL path.
Easy analogy: Customizations after choosing the base item.
GET /users?role=student&limit=5
Simple meaning: Quick numeric summaries of what happened.
Easy analogy: Signal lights before the full explanation.
200 OK
404 Not Found
500 Internal Server Error
How API Works In Real Life
Think about this flow whenever you debug login, fetch profile, create order, update campaign, or delete record issues.
Browser, mobile app, Postman, or frontend code starts the call.
Method, URL, headers, and body travel to the backend.
The server routes the request to the right code.
Validation, auth, and business rules run here.
The backend reads or writes data in MySQL or another service.
The backend sends JSON and a status code back to the client.
HTTP Methods
Read data
Example endpoint: /users
GET /users?limit=2
{
"items": [{"id":101,"name":"Riya"}]
}
Use case: Load a report or fetch one user profile.
Create data
Example endpoint: /users
{
"name": "Ava",
"email": "ava@example.com"
}
{
"id": 103,
"name": "Ava"
}
Use case: Create a user, webhook subscription, or order.
Replace a full record
Example endpoint: /users/101
{
"name": "Riya Das",
"email": "riya@example.com"
}
{
"id": 101,
"name": "Riya Das"
}
Use case: Overwrite a full config or profile.
Update part of a record
Example endpoint: /users/101
{
"role": "Senior Engineer"
}
{
"id": 101,
"role": "Senior Engineer"
}
Use case: Change one field like status or budget.
Remove data
Example endpoint: /users/101
DELETE /users/101
{
"deleted": true,
"id": 101
}
Use case: Delete a record or archive a stale item.
Status Codes
| Status | Meaning | When it happens | Simple example |
|---|---|---|---|
| 200 OK | Request worked | Common success for GET, PUT, PATCH, DELETE | List users returns data. |
| 201 Created | New record created | Common success for POST | Creating a user returns the new row. |
| 400 Bad Request | Input or body is wrong | Missing fields or invalid JSON | POST body forgot email. |
| 401 Unauthorized | Not authenticated | Missing or invalid token | Protected profile call without auth. |
| 403 Forbidden | Authenticated but not allowed | Role lacks permission | Read-only user tries delete. |
| 404 Not Found | Route or record missing | Wrong URL or ID | Requesting id 9999. |
| 409 Conflict | Request conflicts with existing data | Duplicate unique value | Creating the same email twice. |
| 500 Internal Server Error | Backend failed | Unexpected code or DB issue | Query or connection crash. |
Request And Response Examples
Endpoint: /users
Accept: application/jsonNo body needed{
"items": [{"id":101,"name":"Riya"}]
}Status code: 200 OK
Endpoint: /users/101
Accept: application/jsonNo body needed{
"id":101,
"name":"Riya"
}Status code: 200 OK
Endpoint: /users
Content-Type: application/json{
"name": "Ava",
"email": "ava@example.com"
}{
"id":103,
"name":"Ava"
}Status code: 201 Created
Endpoint: /users/101
Content-Type: application/json{
"name": "Riya Das",
"email": "riya@example.com"
}{
"id":101,
"name":"Riya Das"
}Status code: 200 OK
Endpoint: /users/101
Accept: application/jsonNo body needed{
"deleted": true,
"id":101
}Status code: 200 OK
Real-World API Challenges
Symptom: API says you are not authenticated.
Likely cause: Missing or expired token, wrong header format.
How to debug: Check Authorization header and token expiry.
Possible fix: Send a valid token or key again.
Symptom: Create request returns 400 or 409.
Likely cause: Bad JSON, missing fields, duplicate unique value.
How to debug: Check Content-Type and compare body fields to the contract.
Possible fix: Send valid JSON and unique data.
Symptom: Success response but no data.
Likely cause: Filters exclude everything or no rows exist.
How to debug: Remove filters and check the table data.
Possible fix: Seed data or fix query filters.
Symptom: Route or record cannot be found.
Likely cause: Wrong URL or missing ID.
How to debug: Compare path spelling and record id.
Possible fix: Use the right endpoint or create the record first.
Symptom: Browser fails before the API completes.
Likely cause: Server did not allow the frontend origin or header.
How to debug: Inspect browser devtools network headers.
Possible fix: Configure safe CORS rules on the backend.
Symptom: Backend says the body is invalid.
Likely cause: Bad commas, missing quotes, or wrong content type.
How to debug: Validate the JSON body separately.
Possible fix: Send proper JSON with application/json.
Symptom: Response works but feels slow.
Likely cause: Slow queries, big payloads, or downstream calls.
How to debug: Measure DB time, payload size, and dependencies.
Possible fix: Index queries, paginate, or cache.
Symptom: Earlier calls worked, now 401.
Likely cause: Token lifetime passed.
How to debug: Check token expiry and refresh flow.
Possible fix: Refresh or re-login for a new token.
Symptom: Backend crashes unexpectedly.
Likely cause: Unhandled exception or DB failure.
How to debug: Read server logs and stack traces.
Possible fix: Fix backend code and add safer error handling.
Interactive API Test Lab
This playground uses internal mock responses so beginners can safely practice methods, URLs, headers, bodies, status codes, and debugging without touching production data.
Quick Examples
Use one of these presets if you want to see a working request immediately before editing the method, headers, or body yourself.
Example 1
Safe GET example returning a mock user collection.
Example 2
Fetch one simulated user record.
Example 3
Simulate a POST create request with JSON.
Example 4
Simulate patching a campaign status.
Example 5
Try a request with a bearer token header.
Example 6
Practice reading a not-found response.
Practice Tasks
Goal: Read the full mock user list.
Endpoint: /api/v1/lab-playground.php?resource=users
Expected output: 200 OK with an items array.
Hint: Use GET and no body.
GET /api/v1/lab-playground.php?resource=usersGoal: Read one mock user.
Endpoint: /api/v1/lab-playground.php?resource=users&id=101
Expected output: 200 OK with one data object.
Hint: Use the id query param.
GET /api/v1/lab-playground.php?resource=users&id=101Goal: Simulate creating a user safely.
Endpoint: /api/v1/lab-playground.php?resource=users
Expected output: 201 Created with a generated mock row.
Hint: Send name, email, and role.
POST /api/v1/lab-playground.php?resource=users
{
"name": "Practice User",
"email": "practice@example.com",
"role": "Student"
}Goal: Simulate a partial update.
Endpoint: /api/v1/lab-playground.php?resource=campaigns&id=301
Expected output: 200 OK with updated campaign data.
Hint: Use PATCH and send only the changed fields.
PATCH /api/v1/lab-playground.php?resource=campaigns&id=301
{
"status": "paused"
}Goal: Simulate deleting one mock row.
Endpoint: /api/v1/lab-playground.php?resource=users&id=102
Expected output: 200 OK with deleted_id.
Hint: Use DELETE.
DELETE /api/v1/lab-playground.php?resource=users&id=102Goal: Practice using headers cleanly.
Endpoint: /api/v1/lab-playground.php?resource=profile
Expected output: 200 OK with a mock authenticated profile.
Hint: Use Authorization: Bearer demo-token.
Authorization: Bearer demo-token
X-Debug-Mode: practiceGoal: Trigger a not-found case on purpose.
Endpoint: /api/v1/lab-playground.php?resource=users&id=9999
Expected output: 404 Not Found.
Hint: Use an id that does not exist.
GET /api/v1/lab-playground.php?resource=users&id=9999Goal: See validation fail.
Endpoint: /api/v1/lab-playground.php?resource=users
Expected output: 400 Bad Request.
Hint: Try POST without email.
POST /api/v1/lab-playground.php?resource=users
{
"name": "Broken Example"
}Quiz / Questions & Answers
Authentication asks who you are. Authorization asks what you are allowed to do.
They let browsers, frontend code, and humans quickly understand whether a call succeeded, failed, or needs a retry.
It removes frontend complexity and shows the exact method, URL, headers, and body being sent.
Consistent naming, clear JSON, good examples, helpful errors, and predictable status codes.
REST API Interview Questions
Simple answer: A resource-oriented HTTP API style where methods like GET, POST, PUT, PATCH, and DELETE act on resources.
Real-world example: Example: `/users` for a list and `/users/101` for one user.
Simple answer: GET reads data. POST usually creates data or triggers an action.
Real-world example: Example: GET `/reports`, POST `/reports/export`.
Simple answer: PUT usually replaces a full record. PATCH updates only the fields you send.
Real-world example: PATCH may send only `{ "role": "manager" }`.
Simple answer: It means the route or resource was not found.
Real-world example: Example: requesting a user id that does not exist.
Simple answer: Authentication proves identity. Authorization checks permission.
Real-world example: A logged-in user may still not be allowed to delete.
Simple answer: A text format used to structure request and response data.
Real-world example: Example: `{ "id": 1, "name": "Riya" }`.
Simple answer: The exact API URL a client calls.
Real-world example: Example: `GET /api/v1/lab-playground.php?resource=users&id=101`.
Simple answer: Extra metadata sent with the request or response.
Real-world example: Example: `Content-Type: application/json`.
Simple answer: Backend exceptions, bad SQL, missing env vars, or dependency failures.
Real-world example: Example: database connection failure.
Simple answer: Repeating the same request should leave the same final result.
Real-world example: PUT with the same full record twice should not create duplicates.
REST API Learning Path
Learn API, REST, endpoint, request, response, and JSON.
Understand GET, POST, PUT, PATCH, DELETE and the common status families.
Practice headers, bodies, path params, and query params.
Learn API keys, bearer tokens, and permission checks.
Use the API Lab, curl, devtools, and Postman.
Work through 401, 404, CORS, latency, parsing, and 500 cases.
Practice explaining concepts clearly with examples.
Go Deeper
Definitions and examples for programmatic, CTV, privacy, and protocols.
Open pageGo deeper into first principles and curl examples.
Open pageStudy pagination, auth, validation, and frontend usage.
Open pageMove into idempotency, retries, tracing, and caching.
Open pageSee how PHP, MySQL, and JSON fit together in a real site.
Open pageNext Step
Start with the API Lab, move through the challenge cards, then use the deeper pages as your next hands-on exercises.
Enter any two values
to calculate the third
More tools coming soon