#!/usr/bin/perl $baseURL = `cat /opt/folio/headerInfo/baseURL.txt`; $headers = `cat /opt/folio/headerInfo/headers.txt`; use JSON; @ids = ( "5f8314a1-de45-4e36-96af-ddc583b834bf", "e50795e1-3353-43ec-b938-01ccd23c8714", "38727172-c200-4011-b556-6f65954de5f4", "12ef4609-2bca-45ff-bd6d-4ec47aac42c9" ); foreach $instanceId (@ids) { $holdings = `curl -s -X GET $headers $baseURL/holdings-storage/holdings?query=instanceId==$instanceId`; $holdingsHash = decode_json $holdings; for ( @{$holdingsHash->{holdingsRecords}}) { $holdingsRecordId = $_->{'id'}; $items = `curl -s -X GET $headers $baseURL/item-storage/items?query=holdingsRecordId==$holdingsRecordId`; $itemsHash = decode_json $items; for ( @{$itemsHash->{items}}) { $itemId = $_->{'id'}; $delete = `curl -s -X DELETE $headers $baseURL/item-storage/items/$itemId`; print "item $itemId $delete\n"; } $delete = `curl -s -X DELETE $headers $baseURL/holdings-storage/holdings/$holdingsRecordId`; print "holdingsRecord $holdingsRecordId $delete\n"; } $delete = `curl -s -X DELETE $headers $baseURL/instance-storage/instances/$instanceId`; print "instance $instanceId $delete\n"; }