A RESTful API project built using ASP.NET Core for managing books and authors.
This project demonstrates CRUD operations, attribute routing, API testing using Postman, and HTTP debugging using Fiddler while following RESTful API principles.
- RESTful API implementation
- CRUD operations for Books
- Author resource management
- Association between Books and Authors
- Attribute Routing
- Proper HTTP Status Codes
- JSON Responses
- In-Memory Database
- Swagger Integration
- Postman API Testing
- Fiddler HTTP Debugging
- Input Validation
- Error Handling
- ASP.NET Core (.NET 10)
- C#
- Swagger / Swashbuckle
- Postman
- Fiddler Classic
- Visual Studio 2026
BookStoreAPI
│
├── Controllers
│ ├── BooksController.cs
│ └── AuthorsController.cs
│
├── Models
│ ├── Book.cs
│ └── Author.cs
│
├── Data
│ └── AppDbContext.cs
│
├── Program.cs
├── appsettings.json
├── BookStoreAPI.csproj
└── README.md
GET /api/booksGET /api/books/{id}POST /api/booksSample Request Body:
{
"title": "Atomic Habits",
"authorId": 1,
"publicationYear": 2018
}PUT /api/books/{id}Sample Request Body:
{
"id": 1,
"title": "Updated Book",
"authorId": 1,
"publicationYear": 2020
}DELETE /api/books/{id}GET /api/authorsGET /api/authors/{id}POST /api/authorsSample Request Body:
{
"name": "James Clear"
}GET /api/authors/{authorId}/booksThis endpoint demonstrates the relationship between authors and books using RESTful URI routing.
| Status Code | Meaning |
|---|---|
| 200 OK | Successful request |
| 201 Created | Resource created successfully |
| 400 Bad Request | Invalid request data |
| 404 Not Found | Resource not found |
- Required book title
- Required author name
- Publication year validation
- Invalid author ID validation
- Proper error responses
The API gracefully handles:
- Invalid IDs
- Missing resources
- Invalid request data
- Validation failures
Example Error Response:
{
"message": "Book not found"
}Swagger UI is enabled for easy API testing and endpoint visualization.
After running the project:
https://localhost:{port}/swagger
Swagger allows testing all:
- GET APIs
- POST APIs
- PUT APIs
- DELETE APIs
directly from the browser.
The API was tested using Postman for:
- GET requests
- POST requests
- PUT requests
- DELETE requests
- Error handling
- Invalid request testing
- JSON response verification
Example GET Request:
GET https://localhost:{port}/api/booksFiddler Classic was used to:
- Monitor HTTP traffic
- Inspect HTTP requests
- Inspect HTTP responses
- Verify request methods
- Verify response headers
- Verify status codes
- Debug HTTPS requests
- Analyze JSON responses
- Proper HTTP Methods
- Resource-Based URIs
- Stateless Communication
- Standard HTTP Status Codes
- JSON Data Exchange
- Clean Attribute Routing
[
{
"id": 1,
"title": "Harry Potter",
"authorId": 1,
"publicationYear": 1997
}
]- Visual Studio 2026
- .NET 10 SDK
git clone <repository-url>Open:
BookStoreAPI.csproj
in Visual Studio 2026.
If packages are not restored automatically:
Install:
Swashbuckle.AspNetCore
Version:
6.6.2
Build → Build Solution
Shortcut:
Ctrl + Shift + B
Press:
F5
Swagger UI will open automatically.
- GET all books
- GET book by ID
- POST create book
- PUT update book
- DELETE book
- GET all authors
- GET author by ID
- POST create author
- GET books by author
- Required fields validation
- Invalid data handling
- Error responses
- Swagger
- Postman
- Fiddler
- Building RESTful APIs using ASP.NET Core
- Implementing CRUD operations
- Using Attribute Routing
- API testing using Swagger and Postman
- HTTP debugging using Fiddler
- Handling validations and exceptions
- Designing RESTful endpoints
Giridhar Gopal
This project is created for educational and academic purposes.