[Archivesspace_Users_Group] Batch delete

Steven Majewski sdm7g at virginia.edu
Thu May 29 14:50:23 EDT 2014


Apparently, there is also a  /batch_delete method, but I haven’t yet managed to figure out
how to give it the correct record_uris parameter.  I’ve tried several different ways of encoding
record_uris (as a plain string, a json string, a json list of strings… ), and several different resource URIs,
but I always seem to get something like:

{"error":{"record_uris":["Wanted type [String] but got '/repositories/25/resources/3610/tree'"]}}


POST /batch_delete
Description

Carry out delete requests against a list of records

Parameters

[String] record_uris -- A list of record uris
Returns

200 -- deleted



Also: attempting to delete an empty repository from the admin interface yields the error:

Cannot delete - repository not empty

even though the admin browse  shows  no Accessions, Resources or Digital Objects in the repo,
and  API /repositories/:repo_id/resources?all_ids=true   returns  empty  [ ] . 

However, after doing a ‘transfer repository’ to another repo, I am able to delete the first repository. 


Since we’re still testing, we’ve had to frequently resort to just deleting all of the mysql database 
tables and starting over fresh. 


— Steve. 


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

> On 05/28/2014 11:36, Steven Majewski wrote:
>> 
>> On May 28, 2014, at 9:15 AM, Bridger Dyson-Smith <bdysonsm at utk.edu
>> <mailto: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
>> 
>> 
>> 
> Hi Steve -
> thanks for that snippet - it is much appreciated.
> 
> Bridger
> _______________________________________________
> Archivesspace_Users_Group mailing list
> Archivesspace_Users_Group at lyralists.lyrasis.org
> http://lyralists.lyrasis.org/mailman/listinfo/archivesspace_users_group

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lyralists.lyrasis.org/pipermail/archivesspace_users_group/attachments/20140529/eeb0390c/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/20140529/eeb0390c/attachment.bin>


More information about the Archivesspace_Users_Group mailing list