GET patrons/{id} – REST API

Retrieve a Patron: GET /patrons/{id}

Retrieve a single patron by passing the patron’s barcode or email as an id.

Query Parameters

  • id: A unique ID for the patron – parameter accepts either the barcode or email.

JSON Result Details

  • barcode: The barcode – usually assigned automatically by Libib.
  • first_name: Patron’s first name.
  • last_name: Patron’s last name.
  • email: Patron’s email, which they may use to log in and check out / hold items.
  • notification_emails: Optional emails which overrides 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: Any ID that you wish to assign.
  • phone: Patron’s phone number.
  • address1: Patron’s address
  • address2: Patron’s address.
  • city: Patron’s city.
  • state: If country is set to US, the state will be a two character abbreviation.
  • country: The 2 character abbreviation of the country.
  • zip: Patron’s zip code.
  • freeze: Returns 1 (true) if patron has been frozen.
<?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);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  $obj = json_decode($response);
}
{
    "barcode": "2020000000013",
    "first_name": "Mary",
    "last_name": "Shelley",
    "email": "frankenstien@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
}
Updated on March 10, 2024
Was this article helpful?

Related Articles