Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • active = true
  • type = patron
  • personal.preferredContactTypeId = 002 (email)
  • expirationDate: 2/15/2021 for students; 3/15/2021 for employees

The previous version of FOLIO (Fameflower) required me to craft the user's UUID and I am very happy to discover that the current version (Goldenrod) does not. I'm putting my solution to crafting a UUID here so that I will always have it and never need it again:


sub craft_uuid {
$uuid = "";
$m = "12345";
$n = "89abAB";
$x = "0123456789abcdefABCDEF";
for ($y = 1; $y <= 8; $y++) {$r = int(rand(22)); $uuid .= substr($x,$r,1);}
$uuid .= "-";
for ($y = 1; $y <= 4; $y++) {$r = int(rand(22)); $uuid .= substr($x,$r,1);}
$uuid .= "-";
$r = int(rand(5));
$uuid .= substr($m,$r,1);
for ($y = 1; $y <= 3; $y++) {$r = int(rand(22)); $uuid .= substr($x,$r,1);}
$uuid .= "-";
$r = int(rand(5));
$uuid .= substr($n,$r,1);
for ($y = 1; $y <= 3; $y++) {$r = int(rand(22)); $uuid .= substr($x,$r,1);}
$uuid .= "-";
for ($y = 1; $y <= 12; $y++) {$r = int(rand(22)); $uuid .= substr($x,$r,1);}
$json = `curl -s -w '\n' -X GET -H '$jsonHeader' -H '$xOkapiToken' $baseURL/users/$uuid`;
}
for ($infinity = 0; $infinity <= 1; $infinity++) {
craft_uuid();
if ($json =~ /Not found/) {
$infinity++;
} else {
$infinity--;
}
}