API Overview
The University Inventory Management System provides a comprehensive RESTful API that enables programmatic access to all system functionality. This API is designed to be MCP (Model Context Protocol) ready, making it perfect for chatbot integration and automated workflows.
Introduction
The API follows REST principles and returns JSON responses with consistent error handling. All endpoints require authentication, and many operations are restricted based on user roles.
Base URL: /api
API Version: 1.0.0
Response Format: JSON
Authentication: OAuth 2.0 with session management
Key Features
- 🔐 Secure Access
OAuth integration with university systems
Role-based authorization
Session-based authentication with automatic refresh
- 📊 Comprehensive Data Access
Full CRUD operations for inventory items
Category management
Stock movement tracking
User management (admin only)
Notes system for contextual annotations
Bulk operations for efficient inventory management
- 🤖 MCP Integration Ready
Structured responses perfect for AI assistants
Consistent error handling
Descriptive endpoint documentation
Query parameter support for filtering
- 📈 Analytics & Reporting
Dashboard statistics
Low stock alerts
Category analytics
Historical data access
Authentication
All API endpoints require authentication. The system uses session-based authentication with OAuth 2.0.
Authentication Flow:
Initiate Login: Navigate to
/api/loginOAuth Redirect: User authenticates with university system
Session Creation: System creates authenticated session
API Access: Include session cookie in subsequent requests
Session Management:
GET /api/auth/user HTTP/1.1
Host: localhost:5000
Cookie: connect.sid=s%3A...
Response Format:
{
"id": "user123",
"email": "user@university.edu",
"firstName": "John",
"lastName": "Doe",
"role": "manager",
"isActive": true
}
Error Handling
The API uses standard HTTP status codes and returns detailed error information.
Standard Status Codes:
200 OK- Successful request201 Created- Resource created successfully400 Bad Request- Invalid request data401 Unauthorized- Authentication required403 Forbidden- Insufficient permissions404 Not Found- Resource not found500 Internal Server Error- Server error
Error Response Format:
{
"message": "Validation error",
"errors": [
{
"field": "name",
"message": "Name is required"
}
]
}
API Endpoints Overview
Authentication Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
Get current user information |
GET |
|
Initiate login flow |
GET |
|
Logout current user |
Dashboard Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
Get dashboard statistics |
GET |
|
Get low stock items |
GET |
|
Get category statistics |
Inventory Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
List inventory items (with pagination) |
GET |
|
Get specific item details |
POST |
|
Create new item (Manager+) |
PUT |
|
Update item (Manager+) |
DELETE |
|
Delete item (Manager+) |
POST |
|
Update item stock (Manager+) |
Category Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
List all categories |
POST |
|
Create category (Manager+) |
PUT |
|
Update category (Manager+) |
DELETE |
|
Delete category (Admin) |
Stock Movement Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
Get stock movement history |
Notes Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
Get all notes (with filtering) |
GET |
|
Get notes for specific entity |
POST |
|
Create new note |
PUT |
|
Update note |
DELETE |
|
Delete note |
GET |
|
Get note count for entity |
POST |
|
Get note counts (batch) |
Bulk Operations Endpoints
Method |
Endpoint |
Description |
|---|---|---|
POST |
|
Bulk delete items (Manager+) |
POST |
|
Bulk set items inactive (Manager+) |
POST |
|
Bulk set items active (Manager+) |
POST |
|
Bulk set stock to zero (Manager+) |
POST |
|
Bulk export items to CSV/Excel |
POST |
|
Bulk add note to items (Manager+) |
POST |
|
Bulk change VAT rate (Manager+) |
POST |
|
Bulk change category (Manager+) |
User Management Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
List all users (Admin) |
POST |
|
Create new user |
PUT |
|
Update user role (Admin) |
PATCH |
|
Update user role (Admin) |
DELETE |
|
Delete user (Admin) |
PATCH |
|
Reset user password (Admin) |
POST |
|
Request password reset |
PATCH |
|
Update picking list preference |
Sales & Quotes Endpoints
Method |
Endpoint |
Description |
|---|---|---|
POST |
|
Create new quote |
GET |
|
List all quotes |
GET |
|
Get quote details |
PUT |
|
Update quote |
DELETE |
|
Delete quote |
POST |
|
Convert quote to sale |
POST |
|
Record new sale |
GET |
|
List sales records |
PATCH |
|
Mark sale as paid (Manager+) |
PATCH |
|
Mark sale as unpaid (Admin) |
PATCH |
|
Record sale recipient |
POST |
|
Validate stock availability |
GET |
|
Generate sales reports |
GET |
|
Generate low stock report |
Suppliers & Procurement Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
List all suppliers |
GET |
|
Get supplier details |
POST |
|
Create new supplier |
PUT |
|
Update supplier |
DELETE |
|
Delete supplier (Admin+) |
POST |
|
Link item to supplier |
DELETE |
|
Remove item-supplier link (Admin+) |
GET |
|
List all orders |
POST |
|
Upload invoice PDF |
POST |
|
Create order from invoice PDF |
Charge Codes Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
List all charge codes |
GET |
|
Get charge code details |
POST |
|
Create charge code (Admin+) |
PUT |
|
Update charge code (Admin+) |
DELETE |
|
Delete charge code (Admin) |
GET |
|
Get expiring charge codes |
GET |
|
Get authorized users for charge code |
System Configuration Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
Get system settings (Admin) |
PUT |
|
Update system setting (Admin) |
GET |
|
Get user permissions (Admin) |
PUT |
|
Update user permission (Admin) |
GET |
|
Get permission definitions |
GET |
|
Get system alerts |
MCP Integration Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
Charge code usage analytics |
GET |
|
Top selling items analytics |
GET |
|
Department performance metrics |
Monitoring & Health Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
Basic health check |
GET |
|
Detailed API health check |
GET |
|
Deployment notifications |
DELETE |
|
Delete deployment notification |
Safe Deletion Endpoints
Method |
Endpoint |
Description |
|---|---|---|
GET |
|
Check user deletion safety (Admin+) |
DELETE |
|
Safely delete user (Admin) |
GET |
|
Check category deletion safety (Admin+) |
DELETE |
|
Safely delete category (Admin+) |
GET |
|
Check item deletion safety (Admin+) |
DELETE |
|
Safely delete item (Admin+) |
GET |
|
Check supplier deletion safety (Admin+) |
DELETE |
|
Safely delete supplier (Admin+) |
Webhook Endpoints
Method |
Endpoint |
Description |
|---|---|---|
POST |
|
Docker deployment webhooks |
POST |
|
GitHub repository webhooks |
File Upload Endpoints
Method |
Endpoint |
Description |
|---|---|---|
POST |
|
Upload invoice file for processing |
MCP Integration
The API is designed to work seamlessly with Model Context Protocol for chatbot integration:
Common Use Cases:
// Check inventory for specific items
GET /api/items?search=laptop
// Get low stock alerts
GET /api/dashboard/low-stock
// Find items by category
GET /api/items?categoryId=1
// Get price information
GET /api/items/123
OpenAPI Specification
A complete OpenAPI 3.0 specification is available at:
GET /api/docs HTTP/1.1
Host: localhost:5000
Next Steps
Authentication API - Detailed authentication guide
API Endpoints Reference - Complete endpoint documentation
Model Context Protocol (MCP) Integration - MCP integration examples