An open API service indexing awesome lists of open source software.

https://github.com/nisalgunawardhana/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.
https://github.com/nisalgunawardhana/api-learning-101

api api-learning api-rest postman postman-api

Last synced: about 2 months ago
JSON representation

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.

Awesome Lists containing this project

README

          

# 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 Banner](images/banner.png)

## ๐ŸŒ Live Demo

**Backend API**: [api-learning.nisalgunawardhana.com](https://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](https://www.postman.com/cloudy-water-123799/workspace/api-learning)

1. Open the public Postman workspace link above
2. Fork the collection to your workspace
3. Start testing with the live API at `https://api-learning.nisalgunawardhana.com`

### 2. (Optional) Local Testing

If you want to test locally:

```bash
# 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 start
```

The 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/reset` to manually reload initial data
- Perfect for learning and testing without worrying about data cleanup!

## ๐Ÿ“– Learning Path

Follow these guides in order:

1. [What is an API?](docs/01-what-is-api.md)
2. [HTTP Methods](docs/02-http-methods.md)
3. [Status Codes](docs/03-status-codes.md)
4. [REST Principles](docs/04-rest-principles.md)
5. [Postman Guide](docs/05-postman-guide.md)

## ๐Ÿงช Complete Testing Guide

### Step 1: Access Postman Collection

1. Visit the public workspace: [API Learning 101 Collection](https://www.postman.com/cloudy-water-123799/workspace/api-learning)
2. Click **Fork Collection** to add it to your workspace
3. 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**

1. Select `GET All Users` from the collection
2. Click **Send**
3. Verify status code: `200 OK`
4. **Take a screenshot** showing:
- Request URL
- Response status
- Response body with user data

#### ๐Ÿ” **GET Request - Fetch Single User**

1. Select `GET User by ID` from the collection
2. Replace `:id` with `1` in the URL
3. Click **Send**
4. Verify status code: `200 OK`
5. **Take a screenshot**

#### โž• **POST Request - Create User**

1. Select `POST Create User` from the collection
2. Go to **Body** tab (raw JSON)
3. Use this sample data:
```json
{
"name": "Your Name",
"email": "yourname@example.com",
"age": 25
}
```
4. Click **Send**
5. Verify status code: `201 Created`
6. **Take a screenshot** showing the created user with generated ID

#### โœ๏ธ **PUT Request - Update User**

1. Select `PUT Update User` from the collection
2. Use the ID from your created user
3. Update the data in Body:
```json
{
"name": "Updated Name",
"email": "updated@example.com",
"age": 26
}
```
4. Click **Send**
5. Verify status code: `200 OK`
6. **Take a screenshot** showing the updated user

#### ๐Ÿ—‘๏ธ **DELETE Request - Remove User**

1. Select `DELETE User` from the collection
2. Use the ID of the user you created
3. Click **Send**
4. Verify status code: `200 OK`
5. **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

1. Add your screenshots to the `docs/screenshots/` folder
2. Create a Pull Request with your screenshots
3. Go to **Issues** โ†’ **New Issue**
4. Select **๐Ÿ“ Submission** template
5. Fill in:
- Your name
- Email address (for badges and prize notifications)
- GitHub username
- PR number
- T-shirt size (for winners only)
6. 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**:
1. Share your completion on Twitter/LinkedIn/Facebook
2. Tag **@NisalGunawardhana** and **@Postman**
3. Use hashtag **#APILearning101**
4. 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](docs/05-postman-guide.md) 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:

1. Fork the repository
2. Create your feature branch
3. Make your changes
4. Submit a pull request
5. Create a submission issue

Your submission will be reviewed and you'll receive contributor badges!

## ๐Ÿ“ Submission Process

1. Complete your work and create a PR
2. Use the **Submission** issue template
3. Fill in all required details
4. Your submission will be automatically tagged and assigned for review
5. 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](https://github.com/nisalgunawardhana))

---

Happy Learning! ๐ŸŽ‰