This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to a plugin's backend/controllers directory | |
class ArchivesSpaceService < Sinatra::Base | |
Endpoint.get('/repositories/:repo_id/resources/:id/archival_object_ids') | |
.description("Get a list of archival objects IDs associated with a resource") | |
.params(["id", :id], | |
["repo_id", :repo_id]) | |
.permissions([:view_repository]) | |
.returns([200, "OK"]) \ | |
do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
username = "username" | |
password = "password" | |
aspace_url = "http://localhost:8089" | |
authenticate = requests.post("{}/users/{}/login?password={}".format(aspace_url, username, password)).json() | |
token = authenticate["session"] | |
headers = {"X-ArchivesSpace-Session":token} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lxml import etree | |
import os | |
from os.path import join | |
ead_dir = "path/to/eads" | |
unsplit_lines = [] | |
for filename in os.listdir("reelmapfiles"): | |
with open(join("reelmapfiles", filename), "r") as f: | |
unsplit_lines.extend(f.readlines()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
# Proof of concept update for https://github.com/djpillen/bentley_scripts/blob/master/update_archival_object.py using the new find_by_id endpoint | |
aspace_url = 'http://localhost:8089' | |
username= 'admin' | |
password = 'admin' | |
auth = requests.post("{0}/users/{1}/login?password={2}".format(aspace_url, username, password)).json() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
#Change these | |
aspace_url = 'http://localhost:8089' | |
username = 'admin' | |
password = 'admin' | |
auth = requests.post("{0}/users/{1}/login?password={2}".format(aspace_url, username, password)).json() | |
session = auth['session'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import time | |
import json | |
# This script is used to setup BHL ArchivesSpace defaults for running test migrations | |
def test_connection(): | |
try: | |
requests.get('http://localhost:8089') | |
print 'Connected!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# These will be used to edit the ArchivesSpace config file to use the correct database URL and setup our plugins | |
DBURL='AppConfig[:db_url] = "jdbc:mysql://localhost:3306/archivesspace?user=as\&password=as123\&useUnicode=true\&characterEncoding=UTF-8"' | |
PLUGINS="AppConfig[:plugins] = ['bhl-ead-importer','bhl-ead-exporter','container_management','aspace-jsonmodel-from-format']" | |
echo "Installing plugins" | |
cd /home/vagrant | |
echo "Installing container management" | |
# Grab a release instead of cloning the repo to make sure it's a version compatible with latest ArchivesSpace releases | |
wget https://github.com/hudmol/container_management/releases/download/1.1/container_management-1.1.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "Stopping ArchivesSpace" | |
service archivesspace stop | |
echo "Dropping and recreating database" | |
mysql -uroot -prootpwd -e "drop database archivesspace" | |
mysql -uroot -prootpwd -e "create database archivesspace" | |
mysql -uroot -prootpwd -e "grant all on archivesspace.* to 'as'@'localhost' identified by 'as123'" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import os | |
from os.path import join | |
latest_release_api = 'https://api.github.com/repos/archivesspace/archivesspace/releases/latest' | |
save_dir = '/home/vagrant' | |
if not os.path.exists(save_dir): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
echo "Installing dependencies" | |
apt-get -y install default-jre | |
apt-get -y install unzip | |
apt-get -y install git | |
cd /vagrant | |
echo "Downloading latest ArchivesSpace release" |
NewerOlder