| Method | Endpoint |
|---|---|
| POST | /api/patron/upsert |
| GET | /api/patron/view |
| GET | /api/patron/view?cardnumber=XXX |
| GET | /api/patron/overdue |
| GET | /api/patron/overdue?cardnumber=XXX |
| POST | /api/patron/delete |
| Mode | Rule |
|---|---|
| Insert | If cardnumber does not exist → send full patron JSON |
| Update | If exists → cardnumber mandatory; send only keys to change |
| Multiple | Put one or many objects inside "data": [ ... ] |
Insert mandatory: cardnumber, surname, firstname, categorycode, userid, password
Optional borrower fields: title, othernames, initials, streetnumber, address, address2, city, state, zipcode, country, email, phone, dateofbirth, dateenrolled, dateexpiry, sex, branchcode (default DLRL)
Image: imagefile (base64 data URI) + optional mimetype (e.g. image/png)
| Code | Example |
|---|---|
| DESIG | SCIENTIS-E |
| DIV | MV-3 |
| RT | No |
{
"data": [
{
"cardnumber": "CQR40",
"surname": "VVVV",
"firstname": "K",
"title": "CQR40",
"othernames": "VK",
"initials": "K",
"streetnumber": "123",
"address": "Coimbatore",
"address2": "",
"city": "Mettupalayam",
"state": "TamilNadu",
"zipcode": "641301",
"country": "India",
"email": "vk123@gmail.com",
"phone": "1234567890",
"dateofbirth": "2000-01-01",
"categorycode": "2CQR",
"dateenrolled": "2024-09-19",
"dateexpiry": "2040-09-19",
"sex": "M",
"userid": "CQR40",
"password": "CQR40",
"imagefile": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/...",
"mimetype": "image/png",
"DESIG": "SCIENTIS-E",
"DIV": "MV-3",
"RT": "No"
}
]
}
{
"data": [
{
"cardnumber": "CQR40",
"email": "new.email@gmail.com",
"phone": "9876543210",
"DESIG": "SCIENTIST"
}
]
}
{
"status": true,
"message": "All patrons processed successfully.",
"success_count": 1,
"failed_count": 0,
"results": [
{
"success": true,
"index": 0,
"cardnumber": "CQR40",
"borrowernumber": 101,
"action": "insert",
"message": "Patron inserted successfully."
}
]
}
action is insert or update. Each patron is saved in a DB transaction (borrowers + patronimage + borrower_attributes).
/api/patron/view/api/patron/view?cardnumber=CQR40Returns borrower fields (password excluded), imagefile (base64), mimetype, flat attributes DESIG / DIV / RT, and codes_attributes list.
/api/patron/overdue/api/patron/overdue?cardnumber=CQR40Designation = borrower_attributes where code = DESIG.
Columns: S_No, ID_No, Name, Designation, Acc_No, Title, Author, Issue_Date, Due_Date, Overdue_Days
cardnumber is mandatory. Deletes in order: patronimage → borrower_attributes → borrowers.
{
"data": [
{ "cardnumber": "CQR40" }
]
}
| Message | Cause |
|---|---|
| Authorization header is required... | Missing Basic Auth |
| Invalid username or password. | Bad credentials |
| Invalid JSON body: ... | Malformed JSON (check trailing commas) |
| cardnumber is mandatory... | Missing cardnumber |
| Insert failed. Missing mandatory field(s): ... | Incomplete insert |
| imagefile is not valid base64 data. | Bad image payload |
| Cardnumber "X" not found. Nothing deleted. | Delete target missing |
| Database connection failed... | Wrong DB config |