Patrons Pro
GET /patrons
Retrieve a list of all existing patrons on your site. Returns 50 patrons at a time with pagination support.
curl --location 'https://api.libib.com/patrons?page=1' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-api-user: YOUR_API_USER'<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.libib.com/patrons?page=1",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 15,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-api-key: YOUR_API_KEY",
"x-api-user: YOUR_API_USER"
),
));
$response = curl_exec($curl);
curl_close($curl);
// Valid responses are always in JSON
$data = json_decode($response);import requests
url = "https://api.libib.com/patrons"
headers = {
'x-api-key': 'YOUR_API_KEY',
'x-api-user': 'YOUR_API_USER',
}
params = {
'page': 1
}
response = requests.get(url, headers=headers, params=params)
data = response.json()Query Parameters
| Field | Description |
|---|---|
page | Page number to return (50 patrons per page). |
JSON Result Details
| Field | Description |
|---|---|
total | Total number of patrons on the account. |
pages | Total number of pages available. |
max_per_page | Number of patrons per page (currently fixed at 50). |
patrons | Array of patron objects. barcode, first_name, last_name, email, notification_emails, tags, patron_id, phone, address1, address2, city, state, country, zip, freeze |
{
"total": 2,
"pages": 1,
"max_per_page": 50,
"patrons": [
{
"barcode": "2020000000013",
"first_name": "Mary",
"last_name": "Shelley",
"email": "frankenstein@example.com",
"notification_emails": null,
"tags": null,
"patron_id": "mshelley",
"phone": "555-123-4567",
"address1": null,
"address2": null,
"city": "Augusta",
"state": "KS",
"country": "US",
"zip": null,
"freeze": null
},
{
"barcode": "2020000000037",
"first_name": "Marcus",
"last_name": "Aurelius",
"email": "meditiations@example.com",
"notification_emails": null,
"tags": null,
"patron_id": null,
"phone": null,
"address1": null,
"address2": null,
"city": null,
"state": null,
"country": "US",
"zip": null,
"freeze": 1
}
]
}GET patrons/{id}
Retrieve a single patron by passing the patron's barcode or email as an id.
curl --location 'https://api.libib.com/patrons/2020000000013' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-api-user: YOUR_API_USER'<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.libib.com/patrons/2020000000013",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 15,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => array(
"x-api-key: YOUR_API_KEY",
"x-api-user: YOUR_API_USER"
),
));
$response = curl_exec($curl);
curl_close($curl);
// Valid responses are always in JSON
$data = json_decode($response);import requests
url = "https://api.libib.com/patrons/2020000000013"
headers = {
'x-api-key': 'YOUR_API_KEY',
'x-api-user': 'YOUR_API_USER',
}
response = requests.get(url, headers=headers)
data = response.json()JSON Result Details
| Field | Description |
|---|---|
barcode | The assigned identifier for the patron. |
first_name | Patron's first name. |
last_name | Patron's last name. |
email | Login credential and contact address for checkouts/holds. |
notification_emails | Optional emails which override the email when sending out notifications. Up to 3 emails allowed, comma separated. |
tags | Tags that have been assigned to this patron, comma separated. |
patron_id | Custom identifier assigned by the managers. |
phone | Contact telephone number. |
address1 | Street address line 1. |
address2 | Street address line 2. |
city | City. |
state | The state will be a 2-character abbreviation for US addresses. Otherwise it is dependant on manager input. |
country | 2-character country code. |
zip | Postal code. |
freeze | Returns 1 (true) if patron has been frozen. |
{
"barcode": "2020000000013",
"first_name": "Mary",
"last_name": "Shelley",
"email": "frankenstein@example.com",
"notification_emails": null,
"tags": null,
"patron_id": "mshelley",
"phone": "555-123-4567",
"address1": null,
"address2": null,
"city": "Augusta",
"state": "KS",
"country": "US",
"zip": null,
"freeze": null
}POST /patrons
Create a new patron in the account.
curl --location --request POST 'https://api.libib.com/patrons?first_name=Mary&last_name=Shelley&email=frankenstein@example.com&password=2ab3940as94ikd2394k' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-api-user: YOUR_API_USER'<?php
$curl = curl_init();
$params = array(
'first_name' => 'Mary',
'last_name' => 'Shelley',
'email' => 'frankenstein@example.com',
'notification_emails' => 'frankenstein@example.com,another.email@example.com',
'password' => '2ab3940as94ikd2394k'
);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.libib.com/patrons?" . http_build_query($params),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
"x-api-key: YOUR_API_KEY",
"x-api-user: YOUR_API_USER"
),
));
$response = curl_exec($curl);
curl_close($curl);
// Valid responses are always in JSON
$data = json_decode($response);import requests
url = "https://api.libib.com/patrons"
headers = {
'x-api-key': 'YOUR_API_KEY',
'x-api-user': 'YOUR_API_USER',
}
params = {
'first_name': 'Mary',
'last_name': 'Shelley',
'email': 'frankenstein@example.com',
'password': '2ab3940as94ikd2394k'
}
response = requests.post(url, headers=headers, params=params)
data = response.json()Query Parameters
| Field | Required | Description |
|---|---|---|
first_name | Yes | Patron's first name. |
last_name | Yes | Patron's last name. |
email | No | Must be unique. |
password | No | Required for patron login and item checkout/holds. |
notification_emails | No | Up to 3 comma-separated emails for notifications. |
tags | No | Comma-separated patron tags. |
patron_id | No | Custom ID assignment (not required to be unique). |
phone | No | Contact phone number. |
address1 | No | Street address line 1. |
address2 | No | Street address line 2. |
city | No | City. |
state | No | State (2-character abbreviation for US). |
country | No | 2-character country code. |
zip | No | Postal code. |
freeze | No | Set to 1 to freeze patron account. |
barcode | No | 5-15 digits. THIS SHOULD GENERALLY NOT BE USED! Libib will automatically create a custom barcode for each patron. If a barcode is included in the parameters, it will be used to create the new patron. However, the barcode you create may not work with our system and we can not provide support for it. A possible use case for this field is if you need to re-instate a deleted patron and want to use their previously assigned barcode. |
Custom Barcodes
Barcodes are always auto-assigned by Libib. Overriding this behavior by assigning your own barcodes often prevents Libib from working as expected. Libib is unable to support any issues that arise from using non-supported barcodes.
JSON Result Details
Password is never returned in result set.
{
"barcode": "2020000000051",
"first_name": "Mary",
"last_name": "Shelley",
"email": "frankenstein@example.com",
"notification_emails": "frankenstein@example.com,another.email@example.com",
"tags": null,
"patron_id": null,
"phone": null,
"address1": null,
"address2": null,
"city": null,
"state": null,
"country": "US",
"zip": null,
"freeze": null
}POST /patrons/{id}
Update specific fields for an existing patron. Pass the patron's barcode or email as the id.
curl --location --request POST 'https://api.libib.com/patrons/2020000000051?email=satoshi.kon@example.com&password=2ab3940as94ikd2394k¬ification_emails=' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-api-user: YOUR_API_USER'<?php
$curl = curl_init();
$params = array(
'email' => 'satoshi.kon@example.com',
'password' => '2ab3940as94ikd2394k',
'notification_emails' => ''
);
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.libib.com/patrons/2020000000051?" . http_build_query($params),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => array(
"x-api-key: YOUR_API_KEY",
"x-api-user: YOUR_API_USER"
),
));
$response = curl_exec($curl);
curl_close($curl);
// Valid responses are always in JSON
$data = json_decode($response);import requests
url = "https://api.libib.com/patrons/2020000000051"
headers = {
'x-api-key': 'YOUR_API_KEY',
'x-api-user': 'YOUR_API_USER',
}
params = {
'email': 'satoshi.kon@example.com',
'password': '2ab3940as94ikd2394k',
'notification_emails': ''
}
response = requests.post(url, headers=headers, params=params)
data = response.json()Query Parameters
Empty string values remove existing data. Omit parameters you don't want to change.
| Field | Description |
|---|---|
first_name | Patron's first name. |
last_name | Patron's last name. |
email | Must be unique. |
password | Login credential for patron portal. |
notification_emails | Up to 3 comma-separated emails for notifications. |
tags | Comma-separated patron tags. |
patron_id | Custom ID (non-unique). |
phone | Phone number. |
address1 | Street address line 1. |
address2 | Street address line 2. |
city | City. |
state | State (2-character abbreviation for US). |
country | 2-character country code. |
zip | Postal code. |
freeze | Set to 1 to freeze account. |
barcode | 5-15 digits. THIS SHOULD GENERALLY NOT BE USED! Libib will have automatically assigned a custom barcode for each patron (unless previously overwritten). If a barcode is included in the parameters, it will be used to update the patron’s barcode. However, the barcode you create may not work with our system and we can not provide support for it. A possible use case for this field is if you need to correct an overwritten barcode. (If included, can not be empty) |
Custom Barcodes
Barcodes are always auto-assigned by Libib. Overriding this behavior by assigning your own barcodes often prevents Libib from working as expected. Libib is unable to support any issues that arise from using non-supported barcodes.
JSON Result Details
Password is never returned in result set.
{
"barcode": "2020000000051",
"first_name": "Satoshi",
"last_name": "Kon",
"email": "satoshi.kon@example.com",
"notification_emails": null,
"tags": null,
"patron_id": "skon",
"phone": null,
"address1": null,
"address2": null,
"city": null,
"state": null,
"country": "JP",
"zip": null,
"freeze": null
}PATCH /patrons/{id}
Restore a previously deleted patron. Patrons can be restored within 30 days of deletion. Pass the patron's barcode or email as the id.
curl --location --request PATCH 'https://api.libib.com/patrons/2020000000051' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-api-user: YOUR_API_USER'<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.libib.com/patrons/2020000000051",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 15,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_HTTPHEADER => array(
"x-api-key: YOUR_API_KEY",
"x-api-user: YOUR_API_USER"
),
));
$response = curl_exec($curl);
curl_close($curl);
// Valid responses are always in JSON
$data = json_decode($response);import requests
url = "https://api.libib.com/patrons/2020000000051"
headers = {
'x-api-key': 'YOUR_API_KEY',
'x-api-user': 'YOUR_API_USER',
}
response = requests.patch(url, headers=headers)
data = response.json()Restoration Limitations
Restoration will fail if the patron's email has been reassigned to a new user account.
Response
A successful restoration returns status code 200 with no body content.
DELETE patrons/{id}
Remove a single patron by passing the patron's barcode or email as the id. Deleting a patron dissociates their entire lending/hold history.
curl --location --request DELETE 'https://api.libib.com/patrons/2020000000013' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'x-api-user: YOUR_API_USER'<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.libib.com/patrons/2020000000013",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_CONNECTTIMEOUT => 5,
CURLOPT_TIMEOUT => 15,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => array(
"x-api-key: YOUR_API_KEY",
"x-api-user: YOUR_API_USER"
),
));
$response = curl_exec($curl);
curl_close($curl);import requests
url = "https://api.libib.com/patrons/2020000000013"
headers = {
'x-api-key': 'YOUR_API_KEY',
'x-api-user': 'YOUR_API_USER',
}
response = requests.delete(url, headers=headers)Active Checkouts
Patrons with active checkouts cannot be deleted. Attempting to do so will return a 400 error.
Response
A successful deletion returns status code 204 with no body content.