Skip to main content

01. Postman for API Testing

Level: Beginner

ℹ️ What You'll Learn
  • Why manual testing beats guessing if your API works
  • Install and configure Postman
  • Make GET, POST, PUT, DELETE requests
  • Test your School Management System API
  • Organize requests in collections
  • Share collections with your team

The Problem

After building a .NET Web API, you need to test it before the frontend team uses it. You can't test in your head. Postman gives you a visual tool to send HTTP requests, see responses, and save tests for later.

Install Postman

Download from: https://www.postman.com/downloads/

Install and optionally sign up (free account recommended).

Create Request

New → HTTP:

GET http://localhost:5000/api/students/101

Click Send.

Response appears:

{
"id": 101,
"name": "Ravi Kumar",
"rollNumber": "SMS-2024-001",
"className": "10-A"
}

Common SMS API Requests

Get Student

GET http://localhost:5000/api/students/101

Create Student

POST http://localhost:5000/api/students
Content-Type: application/json

{
"name": "Priya Sharma",
"rollNumber": "SMS-2024-002",
"className": "10-B",
"status": "Active"
}

Update Student

PUT http://localhost:5000/api/students/101
Content-Type: application/json

{
"id": 101,
"name": "Ravi Kumar Updated",
"className": "10-A"
}

Delete Student

DELETE http://localhost:5000/api/students/101

Collections

Save related requests:

  1. Create collection: "SMS API"

  2. Add requests:

    • GET /api/students/{id}
    • POST /api/students
    • PUT /api/students/{id}
    • DELETE /api/students/{id}
  3. Share with team

  4. Run entire collection

Environment Variables

Create "Development" environment:

api_url: http://localhost:5000
student_id: 101

Use in requests:

{{api_url}}/api/students/{{student_id}}

Switch environments: Dev, Staging, Production.

Assertions

Add tests to requests:

pm.test("Status 200", function() {
pm.response.to.have.status(200);
});

pm.test("Response has name", function() {
pm.expect(pm.response.json().name).to.exist;
});

Green ✓ = pass, Red ✗ = fail.

Key Takeaways

  • Postman = API testing client
  • Collections = organize requests
  • Environment = swap endpoints
  • Tests = validate responses
💡 Postman Tip

Export collections as JSON. Share with team, import into their Postman.

🤖Use AI to Learn Faster

Use ChatGPT, Claude, or Copilot to go deeper on Postman Testing. Try these prompts:

  • "How do I create an API request?"
  • "How do I test API responses?"
  • "How do I use environment variables?"
  • "Quiz me on Postman"

💡 Tip: After reading this article, paste your own code into AI and ask "What could go wrong here and why?" — fastest way to find edge cases and deepen understanding.

nexcoding.in