Librarian Mobile App REST API
Official API reference for the EduPulse School Librarian and Library Management Mobile Application. Supports camera barcode & ISBN scanning, book catalog management, book checkout/issuing (temporary borrowing vs permanent copy issue), return inspection, overdue alerts with SMS reminders, book hold reservations, member lookup, digital e-books, and GPS shift attendance.
Authentication & Security
Protected librarian endpoints require the Authorization: Bearer <API_TOKEN> HTTP header. Tokens are issued upon authenticating with phone/email and PIN.
Authorization: Bearer 34f8a92b7c61029e8d475a1c2b3e4f5061728394a5b6c7d8e9f0123456789abc
Content-Type: application/json
Standard Response Envelope
{
"success": true,
"status_code": 200,
"message": "Operation completed successfully",
"data": { ... },
"errors": null
}
{
"success": false,
"status_code": 422,
"message": "book_id and borrower_name are required.",
"data": null,
"errors": null
}
Authentication & Librarian Profile
Authenticates school librarian or bursar using phone/email and PIN or password.
Request Payload:
{
"login": "moses.musoke@stjulian.edu.ug",
"password": "1234"
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Librarian login successful. Welcome to the library management portal!",
"data": {
"token": "34f8a92b7c61029e8d475a1c2b3e4f5061728394a5b6c7d8e9f0123456789abc",
"user": {
"id": 20,
"name": "Tr. Moses Musoke",
"email": "moses.musoke@stjulian.edu.ug",
"phone": "+256755575803",
"role_id": 8,
"role_name": "librarian",
"role_display": "School Librarian",
"school_id": 1,
"school_name": "St. Julian High School",
"school_logo": "uploads/logos/school_logo_1.png"
}
}
}
Request Payload:
{ "login": "+256755575803" }Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Password reset verification code dispatched.",
"data": { "login": "+256755575803", "sms_sent": true, "step": "verify_reset_code" }
}
Request Payload:
{ "login": "+256755575803", "otp_code": "8419", "new_password": "4321" }Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Password reset successfully! You are now logged in.",
"data": { "token": "34f8a92b7c61029e8d475a1c2b3e4f5061728394a5b6c7d8e9f0123456789abc", "user": { "id": 20, "name": "Tr. Moses Musoke" } }
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Logged out successfully.",
"data": null,
"errors": null
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Librarian profile retrieved",
"data": {
"user": {
"id": 20,
"name": "Tr. Moses Musoke",
"email": "moses.musoke@stjulian.edu.ug",
"phone": "+256755575803",
"role_name": "librarian",
"role_display": "School Librarian"
},
"school": {
"name": "St. Julian High School",
"logo_url": "uploads/logos/school_logo_1.png"
},
"stats": {
"total_titles": 4,
"total_copies": 160,
"available_copies": 129,
"active_loans": 1
}
}
}
Request Payload:
{
"name": "Tr. Moses Musoke",
"phone": "+256755575803",
"email": "moses.musoke@stjulian.edu.ug"
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Profile updated successfully!",
"data": {
"user": {
"id": 20,
"name": "Tr. Moses Musoke",
"email": "moses.musoke@stjulian.edu.ug",
"phone": "+256755575803",
"photo_url": "uploads/librarians/lib_1786948211.jpg"
}
}
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Librarian digital badge retrieved",
"data": {
"staff": {
"id": 20,
"staff_code": "LIB-0020",
"name": "Tr. Moses Musoke",
"role": "Chief Librarian & Resource Manager",
"phone": "+256755575803"
},
"school": {
"name": "St. Julian High School",
"logo_url": "uploads/logos/school_logo_1.png"
},
"barcode_data": "LIB-0020",
"qr_string": "EDUPULSE-LIBRARY:20:LIB-0020:SCH-1"
}
}
Library Dashboard & Live Census
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Library dashboard overview retrieved",
"data": {
"metrics": {
"total_titles": 4,
"total_copies": 160,
"available_copies": 129,
"borrowed_copies": 1,
"overdue_loans": 1,
"today_issued": 0,
"today_returned": 0,
"pending_holds": 0
},
"recent_loans": [
{
"id": 1,
"book_title": "Advanced Level Pure Mathematics P1 & P2",
"borrower_name": "Brian Kimuli (Senior 4 (UCE))",
"issue_date": "2026-07-22",
"due_date": "2026-07-25",
"status": "issued"
}
],
"categories": [
{ "category": "Literature in English", "title_count": 1, "total_copies": "60", "available_copies": "50" },
{ "category": "Mathematics", "title_count": 1, "total_copies": "30", "available_copies": "21" },
{ "category": "Sciences", "title_count": 1, "total_copies": "45", "available_copies": "38" }
]
}
}
Universal Library Barcode / QR Scanner
Multi-entity scanning: Book ISBNs, Student IDs, Staff Cards, and Loan references.
Scenario A: Request Payload (Book ISBN):
{
"scanned_code": "ISBN-978-0435"
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Book identified: Advanced Level Pure Mathematics P1 & P2",
"data": {
"entity_type": "book",
"book": {
"id": 2,
"school_id": 1,
"book_title": "Advanced Level Pure Mathematics P1 & P2",
"author": "J. K. Backhouse",
"isbn_code": "ISBN-978-0435",
"category": "Mathematics",
"total_copies": 30,
"available_copies": 21,
"shelf_location": "Shelf B-01",
"condition_status": "Good"
},
"active_loans": [
{
"id": 1,
"borrower_name": "Brian Kimuli (Senior 4 (UCE))",
"issue_date": "2026-07-22",
"due_date": "2026-07-25",
"status": "issued"
}
]
}
}
Scenario B: Request Payload (Student ID Card):
{
"scanned_code": "STU-2026-008"
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Student borrower identified: mukibi hr",
"data": {
"entity_type": "student",
"student": {
"id": 8,
"student_code": "STU-2026-008",
"admission_no": "ADM/2026/875",
"full_name": "mukibi hr",
"class_name": "Primary 1",
"parent_phone": "0755575803"
},
"borrowed_books": [],
"overdue_count": 0
}
}
Book Catalog & Inventory Management
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Book catalog list retrieved",
"data": [
{
"id": 1,
"school_id": 1,
"book_title": "Longman Secondary Chemistry Book 4",
"author": "A. Atkinson",
"isbn_code": "ISBN-978-0582",
"category": "Sciences",
"total_copies": 45,
"available_copies": 38,
"shelf_location": "Shelf A-02",
"condition_status": "Good"
}
]
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Book details retrieved",
"data": {
"book": {
"id": 1,
"book_title": "Longman Secondary Chemistry Book 4",
"author": "A. Atkinson",
"isbn_code": "ISBN-978-0582",
"category": "Sciences",
"total_copies": 45,
"available_copies": 38,
"shelf_location": "Shelf A-02",
"condition_status": "Good"
},
"recent_loans": []
}
}
Request Payload:
{
"book_title": "Macbeth (Cambridge School Shakespeare)",
"author": "William Shakespeare",
"isbn_code": "ISBN-978-1107615495",
"category": "Literature in English",
"shelf_location": "Shelf C-02",
"total_copies": 40,
"condition_status": "New"
}
Sample Response (`201 Created`):
{
"success": true,
"status_code": 201,
"message": "New library book 'Macbeth (Cambridge School Shakespeare)' added to catalog!",
"data": {
"id": 5,
"book_title": "Macbeth (Cambridge School Shakespeare)",
"total_copies": 40,
"available_copies": 40
}
}
Request Payload:
{
"book_id": 5,
"shelf_location": "Shelf C-03",
"total_copies": 45
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Library book 'Macbeth (Cambridge School Shakespeare)' updated successfully!",
"data": { "id": 5, "total_copies": 45, "shelf_location": "Shelf C-03" }
}
Request Payload:
{ "book_id": 5 }Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Book removed from library catalog.",
"data": null
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Book categories retrieved",
"data": [
{ "category": "Literature in English", "titles_count": 2, "copies_count": "100", "available_count": "90" },
{ "category": "Mathematics", "titles_count": 1, "copies_count": "30", "available_count": "21" },
{ "category": "Sciences", "titles_count": 1, "copies_count": "45", "available_count": "38" }
]
}
Book Circulation, Issuing & Checkout
Request Payload:
{
"book_id": 1,
"borrower_type": "student",
"borrower_name": "Sarah Namubiru (Senior 2)",
"borrower_phone": "+256772111222",
"loan_type": "borrow",
"duration_days": 14,
"due_date": "2026-09-13",
"due_time": "17:00",
"notes": "Chemistry practical review checkout"
}
Sample Response (`201 Created`):
{
"success": true,
"status_code": 201,
"message": "Book loan issued successfully for 'Longman Secondary Chemistry Book 4' to Sarah Namubiru (Senior 2)!",
"data": {
"id": 2,
"book_id": 1,
"borrower_name": "Sarah Namubiru (Senior 2)",
"issue_date": "2026-08-30",
"due_date": "2026-09-13",
"due_time": "17:00:00",
"duration_days": 14,
"status": "issued"
}
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Active book loans retrieved",
"data": [
{
"id": 2,
"book_title": "Longman Secondary Chemistry Book 4",
"borrower_name": "Sarah Namubiru (Senior 2)",
"due_date": "2026-09-13",
"is_overdue": 0,
"days_overdue": -14,
"status": "issued"
}
]
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Circulation loans audit history retrieved",
"data": [
{
"id": 1,
"book_title": "Advanced Level Pure Mathematics P1 & P2",
"borrower_name": "Brian Kimuli (Senior 4 (UCE))",
"return_date": "2026-07-25",
"status": "returned"
}
]
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Loan record details retrieved",
"data": {
"id": 1,
"book_title": "Advanced Level Pure Mathematics P1 & P2",
"borrower_name": "Brian Kimuli (Senior 4 (UCE))",
"issue_date": "2026-07-22",
"due_date": "2026-07-25",
"status": "issued"
}
}
Request Payload:
{
"loan_id": 2,
"extra_days": 7,
"reason": "Preparing for midterm chemistry exams"
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Loan extended successfully until Sep 20, 2026",
"data": { "loan_id": 2, "new_due_date": "2026-09-20" }
}
Book Returns & Condition Inspection
Request Payload:
{
"loan_id": 2,
"return_condition": "Good",
"fine_amount_ugx": 0.00,
"notes": "Returned on schedule"
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Book marked as returned successfully in Good condition.",
"data": { "loan_id": 2, "status": "returned", "return_date": "2026-08-30" }
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Overdue book loans retrieved",
"data": [
{
"id": 1,
"book_title": "Advanced Level Pure Mathematics P1 & P2",
"borrower_name": "Brian Kimuli (Senior 4 (UCE))",
"issue_date": "2026-07-22",
"due_date": "2026-07-25",
"days_overdue": 36,
"status": "issued"
}
]
}
Request Payload:
{ "loan_id": 1 }Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Overdue SMS reminder dispatched to +256755575803.",
"data": { "loan_id": 1, "phone": "+256755575803" }
}
Member & Borrower Directory Lookup
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Borrower directory search results",
"data": [
{
"id": 4,
"borrower_name": "Dr. Robert Mukasa",
"id_number": "TCH-001",
"borrower_type": "teacher",
"class_name": "Staff / Faculty",
"contact_phone": "+256772111333"
}
]
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Borrower profile & loan history retrieved",
"data": {
"borrower_name": "Brian Kimuli",
"active_loans": 1,
"returned_loans": 0,
"loans_history": [
{
"id": 1,
"book_title": "Advanced Level Pure Mathematics P1 & P2",
"issue_date": "2026-07-22",
"due_date": "2026-07-25",
"status": "issued"
}
]
}
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Classes, enrolled students and staff roster retrieved",
"data": {
"classes": [
{ "id": 1, "class_name": "Primary 1", "student_count": 12 }
],
"students": [
{ "id": 8, "class_id": 1, "student_name": "mukibi hr", "class_name": "Primary 1", "student_code": "STU-2026-008" }
],
"teachers": [
{ "id": 4, "teacher_name": "Ms. Grace Akello", "staff_id": "TCH-102" }
]
}
}
Book Reservations & Holds
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Book reservations retrieved",
"data": [
{
"id": 1,
"book_id": 2,
"book_title": "Advanced Level Pure Mathematics P1 & P2",
"borrower_name": "Sarah Namubiru",
"reservation_date": "2026-08-30",
"status": "pending"
}
]
}
Request Payload:
{
"book_id": 2,
"borrower_type": "student",
"borrower_name": "Sarah Namubiru",
"borrower_phone": "+256772111222",
"notes": "Hold copy when returned by Brian Kimuli"
}
Sample Response (`201 Created`):
{
"success": true,
"status_code": 201,
"message": "Book hold reservation placed successfully!",
"data": { "reservation_id": 1, "status": "pending" }
}
Request Payload:
{ "reservation_id": 1 }Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Reservation cancelled.",
"data": null
}
Request Payload:
{ "reservation_id": 1 }Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Reservation marked as fulfilled.",
"data": null
}
Shelves & Digital E-Books
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Library shelves directory retrieved",
"data": [
{ "shelf_location": "Shelf A-02", "titles_count": 1, "total_copies": "45" },
{ "shelf_location": "Shelf B-01", "titles_count": 1, "total_copies": "30" }
]
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Digital e-books & curriculum materials retrieved",
"data": [
{
"id": 101,
"title": "Uganda National Curriculum A-Level Chemistry Digital Guide",
"subject": "Chemistry",
"class": "Senior 5 & 6",
"file_format": "PDF",
"file_size_mb": 14.5,
"download_url": "uploads/ebooks/a_level_chemistry_guide.pdf"
}
]
}
Shift GPS Attendance & Clock-In
Request Payload:
{
"latitude": 0.3541,
"longitude": 32.5912
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Librarian shift clock-in recorded at 08:00 AM",
"data": { "action": "clock_in", "check_in_time": "08:00:00", "date": "2026-08-30" }
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Librarian attendance shift history retrieved",
"data": [
{ "id": 104, "date": "2026-08-30", "check_in_time": "08:00:00", "status": "present", "location_name": "School Central Library" }
]
}
Salary & Shift Allowances
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Librarian salary and payslip records retrieved",
"data": {
"salary_structure": {
"basic_salary_ugx": "750000.00",
"allowances_ugx": "100000.00",
"net_salary_ugx": "850000.00"
},
"payment_history": [
{ "id": 19, "month_year": "July 2026", "amount_paid": "850000.00", "payment_method": "Bank Transfer" }
]
}
}
Messaging & Support Chat
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Library support chats retrieved",
"data": [
{ "id": 12, "ticket_number": "LIB-20260830-4182", "subject": "New Chemistry Textbooks Requisition", "status": "open" }
]
}
Request Payload:
{
"subject": "New Chemistry Textbooks Requisition",
"message": "We need 25 additional copies of Longman Secondary Chemistry Book 4.",
"category": "library"
}
Sample Response (`201 Created`):
{
"success": true,
"status_code": 201,
"message": "Library support request created successfully!",
"data": { "chat_id": 12, "ticket_number": "LIB-20260830-4182" }
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Chat messages retrieved",
"data": {
"chat": { "id": 12, "subject": "New Chemistry Textbooks Requisition" },
"messages": [
{ "id": 31, "sender_name": "Tr. Moses Musoke", "message": "We need 25 additional copies.", "created_at": "2026-08-30 11:30:00" }
]
}
}
Request Payload:
{
"chat_id": 12,
"message": "Order approved by the bursar."
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Message sent successfully",
"data": { "message_id": 32 }
}
Circulars & Alerts
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "School announcements retrieved",
"data": [
{
"id": 7,
"title": "National Book Week & Reading Challenge",
"content": "Extended library opening hours until 07:00 PM.",
"priority": "Normal"
}
]
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Librarian notifications retrieved",
"data": {
"unread_count": 1,
"notifications": [
{
"id": 42,
"title": "Book Hold Fulfilled",
"message": "Reserved copy of Pure Mathematics returned.",
"is_read": 0
}
]
}
}
Request Payload:
{ "id": 42 }Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Notification marked as read",
"data": null
}
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "All notifications marked as read",
"data": null
}
Academic Calendar & Events
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Academic calendar events retrieved",
"data": [
{
"id": 4,
"title": "Annual Library Book Stocktaking Week",
"start_date": "2026-08-25",
"end_date": "2026-08-29",
"event_type": "Academic",
"color": "#3b82f6"
}
]
}
Emergency & Safety Panic Dispatch
Sample Response (`200 OK`):
{
"success": true,
"status_code": 200,
"message": "Emergency alerts & hotline directory retrieved",
"data": {
"agency_contacts": [
{ "id": 1, "agency_type": "Uganda Police Toll-Free", "phone_primary": "999", "phone_secondary": "112" },
{ "id": 2, "agency_type": "Fire & Rescue Service", "phone_primary": "112", "phone_secondary": "0414342222" }
]
}
}
Request Payload:
{
"emergency_type": "Library Archive Fire Outbreak",
"location": "School Central Library - Archive Section",
"notes": "Smoke detected near reference archive shelves. Fire extinguisher deployed."
}
Sample Response (`201 Created`):
{
"success": true,
"status_code": 201,
"message": "Emergency panic broadcast dispatched to school administration and rescue units!",
"data": { "incident_id": 23, "emergency_type": "Library Archive Fire Outbreak", "status": "Dispatched" }
}
SDK Code Examples
import axios from 'axios';
const BASE_URL = 'http://localhost/edupulse/index.php?api=librarian';
export const librarianApi = axios.create({ baseURL: BASE_URL });
export const setLibrarianAuthToken = (token: string) => {
librarianApi.defaults.headers.common['Authorization'] = `Bearer ${token}`;
};
// 1. Scan Book or Borrower Barcode
export const scanBarcode = async (scannedCode: string) => {
const res = await librarianApi.post('&action=scan_barcode', { scanned_code: scannedCode });
return res.data;
};
// 2. Issue Book Loan
export const issueBookLoan = async (payload: {
book_id: number;
borrower_type: string;
borrower_name: string;
borrower_phone?: string;
loan_type: 'borrow' | 'permanent_take';
duration_days: number;
due_date: string;
due_time: string;
}) => {
const res = await librarianApi.post('&action=loan_issue', payload);
return res.data;
};
import 'dart:convert';
import 'package:http/http.dart' as http;
class LibrarianApiService {
static const String baseUrl = 'http://localhost/edupulse/index.php?api=librarian';
String? _authToken;
void setToken(String token) {
_authToken = token;
}
Map<String, String> get _headers => {
'Content-Type': 'application/json',
if (_authToken != null) 'Authorization': 'Bearer $_authToken',
};
// 1. Universal Barcode / ISBN Scanner
Future<Map<String, dynamic>> scanBarcode(String code) async {
final response = await http.post(
Uri.parse('$baseUrl&action=scan_barcode'),
headers: _headers,
body: jsonEncode({'scanned_code': code}),
);
return jsonDecode(response.body);
}
// 2. Issue Book Loan
Future<Map<String, dynamic>> issueLoan(Map<String, dynamic> payload) async {
final response = await http.post(
Uri.parse('$baseUrl&action=loan_issue'),
headers: _headers,
body: jsonEncode(payload),
);
return jsonDecode(response.body);
}
}