POST /patrons/{id} – REST API

Update a Patron: POST /patrons/{id}

Update specific fields for an existing patron.

Query Parameters

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

URL Parameters
Values should be paramaterized such as using http_build_query() as per example below. Submitting a parameter with an empty string will remove any existing entry for that field – do not include parameters unnecessarily.

  • first_name: Patron’s first name. (If included, can not be empty)
  • last_name: Patron’s last name. (If included, can not be empty)
  • email: Patron’s email, must be unique.
  • password: Patron’s password, needed to log into the patron page and check out / hold items.
  • notification_emails: Optional emails which overrides the email field only for sending out notifications. Up to 3 emails allowed, comma separated.
  • patron_id: Any ID that you wish to assign, does not need to be unique.
  • tags: Create tags for a patron, comma separated.
  • 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 MUST be the two character abbreviation.
  • country: The valid 2 character abbreviation of the patron’s country. (If included, can not be empty)
  • zip: Patron’s zip code.
  • freeze: Set to 1 to freeze patron
  • barcode: 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. 5-15 digits. (If included, can not be empty)
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: The barcode – assigned automatically by Libib unless specifically overwritten.
  • first_name: Patron’s first name.
  • last_name: Patron’s last name.
  • email: Patron’s email.
  • notification_emails: Optional emails which overrides the email field only for sending out notifications. Up to 3 emails, comma separated.
  • tags: Any tags assigned to patron, comma separated.
  • patron_id: Any ID that you may have assigned.
  • 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: 1 if frozen, otherwise null
<php
$curl = curl_init();

$params = array(
  'email' => 'satoshi.kon@example.com',
  'password' => '2ab3940as94ikd2394k',
  'notification_email' => '' // An empty string will remove any existing data for this field
);

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.libib.com/patrons/2020000000051?" . http_build_query($params),
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_CONNECTTIMEOUT => 5,
  CURLOPT_TIMEOUT => 15,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  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": "2020000000051",
    "first_name": "Satoshi",
    "last_name": "Kon",
    "email": "satoshi.kon@example.com",
    "notification_emails": null,
    "patron_id": "skon",
    "phone": null,
    "address1": null,
    "address2": null,
    "city": null,
    "state": null,
    "country": "JP",
    "zip": null
}
Updated on March 10, 2024
Was this article helpful?

Related Articles