API deleting DIP

53 views
Skip to first unread message

romain guedj

unread,
Mar 29, 2022, 7:34:09 AM3/29/22
to archivematica
Hi All,

I am wondering if there is a possibility to detele DIP from the API because we could only remove DIP one by one through Storage Service and make a new search is quite long.

I have seen documentation for deleting AIP here  Storage Service API - Archivematica .

Should we need to replace  /api/v2/file/<UUID>/delete_aip/ by  /api/v2/file/<UUID>/delete_dip/ ?

Thank you for your help

Cheers,

Romain

gou...@wrlc.org

unread,
Mar 29, 2022, 9:45:57 AM3/29/22
to archivematica
Hi Romain,

AFAIK, there is no API for deleting DIPs. I am also very interested in this to clean up my storage service from over a year of testing. In the absence of the API, I am considering going directly into the database and file system to get rid of them. *** any instructions for that would be appreciated! ***

Also, note that the delete_aip endpoint does not delete the AIP, it only submits a request to the SS to delete the AIP. You still need to go into the SS GUI and delete each one. However, it does put them on a single page to approve the deletion...not the cumbersome searching for DIPs that you refer to.

HTH, Don

Message has been deleted

romain guedj

unread,
Mar 29, 2022, 11:03:13 AM3/29/22
to archivematica
Hi Don,

Thanks for sharing this.


" In the absence of the API, I am considering going directly into the database and file system to get rid of them. *** any instructions for that would be appreciated! ***"

you need to change the status from 'Uploaded' to 'Deleted' in  the following table STORAGE_SERVICE.locations_package and clean up the file on the file system.

So depending of your criteria I would do:

  • make an SQL request in STORAGE_SERVICE.locations_package to get the list of file you may want to remove
  • change the status from 'UPLOADED' to 'DELETED' 
  • Copy all the file path from 'current_path' column of STORAGE_SERVICE.locations_package table or extract the results to csv file 
  • build a bash command from  'current_path' column to remove all the files. So paste the previous copy into a spreadsheet software or use the one you have in the csv file. Create in the column B a formula like ="sudo rm -f /var/archivematica/sharedDirectory/www/AIPsStore/"&A1 . All Current_path are supposedly in column A. Then dragg down the cell B1 to apply the formula to all lines. 
  • Copy and past the B column into text file with the header #!bash ; save the file : fileScriptRemoval.sh
  • change permission sudo chmod +x fileScriptRemoval.sh
  • execute the script sh fileScriptRemoval.sh

I don't if this could be helpfull.

Cheers,

Romain
Reply all
Reply to author
Forward
0 new messages