[Archivesspace_Users_Group] Batch delete

Bridger Dyson-Smith bdysonsm at utk.edu
Wed May 28 11:38:47 EDT 2014


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



More information about the Archivesspace_Users_Group mailing list