DELETE patrons/{id} – REST API

Delete a Patron: DELETE /patrons/{id}

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

Deleting a patron will dissociate their entire lending/hold history in the system. Patrons with active checkouts can not be deleted. A 400 error is returned in this case.

Query Parameters

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

JSON Result Details

HTTP SUCCESS STATUS CODE: 204
A successful deletion will not return any body data.

<?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);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  $obj = json_decode($response);
}
Updated on April 13, 2024
Was this article helpful?

Related Articles