List Patrons: GET /patrons
Retrieve a list of all existing patrons on your site. Returns 50 patrons at a time.
URL Parameters
- page: The page number we want to return. If there are 500 patrons, there would be 10 pages (500/50 = 10).
JSON Result Details
- total: Total number of patrons on the account.
- pages: Total number of pages.
- max_per_page: How many patrons are displayed per page – currently this is hard set at 50.
- patrons: A list of each patron’s data.
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
// We can paginate by using the ?page=X option
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);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
$obj = json_decode($response);
}
{
"total": 2, // Total number of patrons found
"pages": 1, // How may pages of patrons exist
"max_per_page": 50 // Number of patrons displayed per page
"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
}
]
}