[Archivesspace_Users_Group] Batch delete

Steven Majewski sdm7g at virginia.edu
Wed May 28 11:36:38 EDT 2014


On May 28, 2014, at 9:15 AM, Bridger Dyson-Smith <bdysonsm at utk.edu> wrote:

> Hi all,
> 
> Is there a batch process for deleting/backing out of an import job? Or is there some other work-around to accomplish a bulk resource removal?
> 
> Thanks!
> 

You can delete all of the resources in a repo thru the backend web api with something like this:


REPO=http://localhost:8089
#
REPO_ID=$1
#
DELETE='-X DELETE'
for ID in $( curl_as_osx admin admin "$REPO/repositories/$REPO_ID/resources?all_ids=true" | tail -1 | tr '[],' ' ' )
do
curl_as_osx admin admin $DELETE $REPO/repositories/$REPO_ID/resources/$ID | tail -1 | json_pp 
done


i.e. First curl gets the list of resource ids in that repo. Loop over the list and do a HTTP DELETE on each resource. 

If you don’t want to delete them all, there may be a way to do a finer selection thru the search API, but I haven’t figure out how to do it. 
Perhaps something like this  is easier to do in the jirb console. 


— Steve Majewski



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20140528/b2d49739/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4943 bytes
Desc: not available
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20140528/b2d49739/attachment.bin>


More information about the Archivesspace_Users_Group mailing list