DMS-Menula/api-learning-101
Welcome to API Learning 101! This repository is your comprehensive guide to understanding and working with APIs, complete with a fully functional REST API backend and hands-on learning resources.
API Learning 101 ๐
Welcome to API Learning 101! This repository is your comprehensive guide to understanding and working with APIs, complete with a fully functional REST API backend and hands-on learning resources.
๐ Live Demo
Backend API: api-learning.nisalgunawardhana.com
๐ What You'll Learn
This repository provides:
- Complete API fundamentals - HTTP methods, status codes, headers, REST principles
- Working backend API - Real API you can interact with
- Postman collection - Ready-to-use API tests
- Hands-on examples - Practical demonstrations
- Best practices - Industry-standard approaches
๐ Repository Structure
api-learning-101/
โโโ docs/
โ โโโ 01-what-is-api.md
โ โโโ 02-http-methods.md
โ โโโ 03-status-codes.md
โ โโโ 04-rest-principles.md
โ โโโ 05-postman-guide.md
โ โโโ screenshots/
โโโ backend/
โ โโโ api/
โ โ โโโ index.js
โ โโโ data/
โ โ โโโ users.json
โ โโโ package.json
โ โโโ README.md
โโโ postman/
โ โโโ API-Learning-101.postman_collection.json
โโโ .github/
โ โโโ ISSUE_TEMPLATE/
โ โโโ workflows/
โโโ vercel.json
๐ Quick Start
1. Access the Public Postman Collection
๐ Postman Workspace: API Learning 101 Collection
- Open the public Postman workspace link above
- Fork the collection to your workspace
- Start testing with the live API at
https://api-learning.nisalgunawardhana.com
2. (Optional) Local Testing
If you want to test locally:
# Clone the repository
git clone https://github.com/nisalgunawardhana/api-learning-101.git
cd api-learning-101
# Install dependencies
cd backend
npm install
# Run locally
npm startThe API will be available at http://localhost:3000
๐ฏ API Endpoints
Base URL: https://api-learning.nisalgunawardhana.com
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/users |
Get all users |
| GET | /api/users/:id |
Get user by ID |
| POST | /api/users |
Create new user |
| PUT | /api/users/:id |
Update user |
| DELETE | /api/users/:id |
Delete user |
| GET | /api/reset |
Reset data to initial state |
๐ก Note about Data Persistence:
- The API uses in-memory storage (no database required!)
- Data persists during the serverless function's lifetime
- Changes are temporary and reset periodically on Vercel
- Use
GET /api/resetto manually reload initial data - Perfect for learning and testing without worrying about data cleanup!
๐ Learning Path
Follow these guides in order:
๐งช Complete Testing Guide
Step 1: Access Postman Collection
- Visit the public workspace: API Learning 101 Collection
- Click Fork Collection to add it to your workspace
- All requests are pre-configured with the production URL
Step 2: Test Each Request Type
You must test all request types and capture screenshots for submission:
๐ GET Request - Fetch All Users
- Select
GET All Usersfrom the collection - Click Send
- Verify status code:
200 OK - Take a screenshot showing:
- Request URL
- Response status
- Response body with user data
๐ GET Request - Fetch Single User
- Select
GET User by IDfrom the collection - Replace
:idwith1in the URL - Click Send
- Verify status code:
200 OK - Take a screenshot
โ POST Request - Create User
- Select
POST Create Userfrom the collection - Go to Body tab (raw JSON)
- Use this sample data:
{ "name": "Your Name", "email": "yourname@example.com", "age": 25 } - Click Send
- Verify status code:
201 Created - Take a screenshot showing the created user with generated ID
โ๏ธ PUT Request - Update User
- Select
PUT Update Userfrom the collection - Use the ID from your created user
- Update the data in Body:
{ "name": "Updated Name", "email": "updated@example.com", "age": 26 } - Click Send
- Verify status code:
200 OK - Take a screenshot showing the updated user
๐๏ธ DELETE Request - Remove User
- Select
DELETE Userfrom the collection - Use the ID of the user you created
- Click Send
- Verify status code:
200 OK - Take a screenshot showing successful deletion message
Step 3: Organize Your Screenshots
Create a folder named screenshots-[your-github-username] with all 5 screenshots:
screenshots-yourusername/
โโโ 01-get-all-users.png
โโโ 02-get-single-user.png
โโโ 03-post-create-user.png
โโโ 04-put-update-user.png
โโโ 05-delete-user.png
Step 4: Submit Your Work
- Add your screenshots to the
docs/screenshots/folder - Create a Pull Request with your screenshots
- Go to Issues โ New Issue
- Select ๐ Submission template
- Fill in:
- Your name
- GitHub username
- PR number
- T-shirt size (for winners only)
- Submit the issue
Note: Your submission will be automatically assigned to @nisalgunawardhana for review. Once approved, you'll receive completion badges!
๐ Social Media Bonus!
Increase your chances to win Postman swags:
- Share your completion on Twitter/LinkedIn/Facebook
- Tag @nisalgunawardhana and @postman
- Use hashtag #APILearning101
- Winners will be selected randomly from all approved submissions!
๐ Rewards & Badges
After successful submission and review:
Everyone receives:
- โ Submission Approved Badge
- ๐ API Learning 101 Completion Badge
Random winners receive:
- ๐ Exclusive T-Shirt (winners selected randomly)
- ๐ Chance for Postman Swags (share on social media for more chances!)
We've included a comprehensive Postman collection with pre-configured requests:
- โ All CRUD operations
- โ Pre-request scripts
- โ Tests for validation
- โ Environment variables
See the Postman Guide for detailed instructions.
๐ป Backend Technology
- Runtime: Node.js
- Framework: Express.js
- Storage: JSON file (no database needed!)
- Hosting: Vercel
๐ค Contributing
We welcome contributions! Please submit your work:
- Fork the repository
- Create your feature branch
- Make your changes
- Submit a pull request
- Create a submission issue
Your submission will be reviewed and you'll receive contributor badges!
๐ Submission Process
- Complete your work and create a PR
- Use the Submission issue template
- Fill in all required details
- Your submission will be automatically tagged and assigned for review
- Receive your contributor badge upon approval! ๐
๐ Badges
Contributors receive badges based on their submissions:
- ๐ก Pending Review
- โ Approved
- ๐ Closed/Completed
๐ License
MIT License - feel free to use this for learning!
๐จโ๐ป Maintainer
Nisal Gunawardhana (@nisalgunawardhana)
Happy Learning! ๐
