Skip to content

Instantly share code, notes, and snippets.

@jhsimpson
Created May 20, 2016 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhsimpson/14778f0c81edbf2cea0a14f589ff96a2 to your computer and use it in GitHub Desktop.
Save jhsimpson/14778f0c81edbf2cea0a14f589ff96a2 to your computer and use it in GitHub Desktop.
A bash script to make AIP deletion requests from an Archivematica Storage Service
#!/bin/bash
#DEFAULTS
#You can get this information from the Archivematica dashboard in the adminstration tab under general.
#Dashboard
PIPELINEUUID=aaaaaaaa-aaaa-4fc8-a24b-d8bd4d584375
USERID=1
#Storage Service
SSURL=http://xxxx.archivematica.org:8000
USERNAME=test
#APIKEY is needed for storage service 0.9.x and later
APIKEY=xxxxxxxxxxxxxxxxxxxxx
echo 'Welcome to the AIP Deletion Request Generator.'
echo 'We are pleased to help you today.'
echo 'But first, I have questions: '
echo -n 'Reason for deletion: '
read EVENTREASON
#echo -n 'Pipeline uuid: '
#read PIPELINEUUID
echo -n 'Your email address: '
read USEREMAIL
echo -n 'UUID of AIP to delete: '
read AIPUUID
#echo -n 'Storage Service username: '
#read USERNAME
#echo -n 'API Key: '
#read APIKEY
DATA='{"event_reason": "'$EVENTREASON'", "pipeline": "'$PIPELINEUUID'", "user_email": "'$USEREMAIL'", "user_id": 1}'
URL=$SSURL'/api/v2/file/'$AIPUUID'/delete_aip/?username='$USERNAME'&api_key='$APIKEY
#echo $DATA
#echo $URL
curl -H "Content-Type: application/json" --data "$DATA" $URL 2>/dev/null
@jhsimpson
Copy link
Author

Copy this file to your computer (desktop/laptop, not the Archivematica server).
Make the file executable (chmod +x in a terminal on os x or linux)
Run it like:

./delete_aip.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment