Über dieses Dokument

Dieses Dokument kommt zusammen mit einem Vagrantfile und beschreibt die wichtigsten HTTP-Calls in Regal anhand von curl.

Eine komplette Übersicht über das zugrundeliegende System findet sich hier: Regal

Dieses Dokument ist im Format asciidoc geschrieben und kann mit dem Werkzeug asciidoctor in HTML übersetzt werden. Mehr dazu im Abschnitt Dokumentation

1. Preface

The Regal webservices documented by example curl-calls. Examples are assumed to work in the Vagrant-Environment that comes with this document.

Have fun!

2. Environment

Got to your server or to the Vagrant-Box, that comes with this document.

vagrant ssh

Prepare your environment to make the following curl-Calls work!

source /opt/regal/conf/variables.conf
export REGAL_API=http://$SERVER
export API_USER=edoweb-admin

3. regal-api

3.1. Create

3.1.1. Create a new resource

curl -i -u$API_USER:$PASSWORD -XPUT $REGAL_API/resource/regal:1234 -d'{"contentType":"monograph","accessScheme":"public"}' -H'content-type:application/json'

3.1.2. Create a new hierarchy

curl -i -u$API_USER:$PASSWORD -XPUT $REGAL_API/resource/regal:1235 -d'{"parentPid":"regal:1234","contentType":"file","accessScheme":"public"}' -H'content-type:application/json'

3.1.3. Upload binary data

curl -u$API_USER:$PASSWORD -F"data=@$ARCHIVE_HOME/src/REGAL_API/test/resources/test.pdf;type=application/pdf" -XPUT $REGAL_API/resource/regal:1235/data

3.1.4. Create User

curl -u$API_USER:$PASSWORD -d'{"username":"test","password":"test","email":"test@example.org","role":"EDITOR"}' -XPUT $REGAL_API/utils/addUser -H'content-type:application/json'

3.1.5. Upload metadata

curl -XPUT -u$API_USER:$PASSWORD -d'<regal:1234> <dc:title> "Ein Test Titel" .' -H"content-type:text/plain" $REGAL_API/resource/regal:1235/metadata2

^^^^^^^

3.1.6. Order Child Nodes

curl -XPUT -u$API_USER:$PASSWORD -d'{"regal:23","regal:34", .... list of parts in correct order }' $REGAL_API/regal:1235/parts

3.2. Read

3.2.1. Read resource

html

curl $REGAL_API/resource/regal:1234.html

json

curl $REGAL_API/resource/regal:1234.json
curl $REGAL_API/resource/regal:1234.json2

rdf

curl $REGAL_API/resource/regal:1234.rdf

mets

curl $REGAL_API/resource/regal:1234.mets

aleph

curl $REGAL_API/resource/regal:1234.aleph

epicur

curl $REGAL_API/resource/regal:1234.epicur

datacite

curl $REGAL_API/resource/regal:1234.datacite

csv

curl $REGAL_API/resource/regal:1234.csv

wgl

curl $REGAL_API/resource/regal:1234.wgl

oaidc

curl $REGAL_API/resource/regal:1234.oaidc

3.2.2. Read resource tree

curl $REGAL_API/resource/regal:1234/all
curl $REGAL_API/resource/regal:1234/parts

3.2.3. Read binary data

curl $REGAL_API/resource/regal:1234/data

3.2.4. Read Webgatherer Conf

curl $REGAL_API/resource/regal:1234/conf

3.2.5. Read Ordering of Childs

curl $REGAL_API/resource/regal:1234/seq

3.2.6. Read user

not implemented

3.2.7. Read Adhoc Linked Data

curl $REGAL_API/adhoc/uri/$(echo test |base64)

3.3. Update

3.3.1. Update Resource

3.3.2. Update Metadata

curl -s -u$API_USER:$REGAL_PASSWORD -XPOST $REGAL_API/utils/updateMetadata/regal:1234 -H"accept: application/json"

3.3.3. Add URN

POST /utils/lobidify
POST /utils/addUrn
POST /utils/replaceUrn

3.3.4. Enrich

POST /resource/:pid/metadata/enrich

3.4. Delete

3.4.1. Delete resource

curl -u$API_USER:$REGAL_PASSWORD -XDELETE "$REGAL_API/resource/regal:1234";echo

3.4.2. Purge resource

curl -u$API_USER:$REGAL_PASSWORD -XDELETE "$REGAL_API/resource/regal:1234?purge=true";echo

3.4.3. Delete part of resource

curl -u$API_USER:$REGAL_PASSWORD -XDELETE $REGAL_API/resource/regal:1234/seq
curl -u$API_USER:$REGAL_PASSWORD -XDELETE $REGAL_API/resource/regal:1234/metadata
curl -u$API_USER:$REGAL_PASSWORD -XDELETE $REGAL_API/resource/regal:1234/metadata2
curl -u$API_USER:$REGAL_PASSWORD -XDELETE $REGAL_API/resource/regal:1234/data
curl -u$API_USER:$REGAL_PASSWORD -XDELETE $REGAL_API/resource/regal:1234/dc

3.4.4. Delete user

not implemented
GET /find
GET /resource

3.5.3. Search for field

3.6. Misc

3.6.1. Load metadata from Lobid

curl -u$API_USER:$PASSWORD -XPOST "$REGAL_API/utils/lobidify/regal:1234?alephid=HT018920238"

3.6.2. Reread Labels from etikett

curl -u$API_USER:$PASSWORD -XPOST $REGAL_API/context.json

3.6.3. Reindex resource

curl -u$API_USER:$PASSWORD -XPOST $REGAL_API/utils/index/regal:1234 -H"accept: application/json"

4. etikett

4.1. Create

4.1.1. Add Labels to Database

curl -u$API_USER:$PASSWORD -XPOST -F"data=@$ARCHIVE_HOME/src/REGAL_API/conf/labels.json" -F"format-cb=Json" $REGAL_API/tools/etikett -i -L

4.1.2. Add Label

4.2. Read

curl "$REGAL_API/tools/etikett" -H"accept: application/json"

4.2.1. Read Etikett

curl $REGAL_API/tools/etikett?url=http%3A%2F%2Fpurl.orms%2Fissued -H"accept: application/json"

4.3. Update

4.4. Delete

4.4.1. Delete Cache

curl -XDELETE -u$API_USER:$PASSWORD $REGAL_API/tools/etikett/cache

4.5. Misc

5. zettel

5.1. Create

5.1.1. Create RDF-Metadata from Form-Data

5.2. Read

5.2.1. Read HTML-Form

5.3. Search

6. skos-lookup

6.1. Create

6.1.1. Create new Index

curl -i -X POST -H "Content-Type: multipart/form-data" $REGAL_API/tools/skos-lookup/upload -F "data=@/tmp/skos-lookup/test/resources/agrovoc_2016-07-15_lod.nt.gz" -F"index=agrovoc_test" -F"format=NTRIPLES"

6.2. Read

curl -XGET '$REGAL_API/tools/skos-lookup/autocomplete?lang=de&q=Erdnus&callback=mycallback&index=agrovoc_test'

6.3. Search

curl $REGAL_API/tools/skos-lookup/search?q=http%3A%2F%2Faims.fao.org%2Faos%2Fagrovoc%2Fc_13551&lang=de&index=agrovoc

7. thumby

7.1. Read

curl -XGET "$REGAL_API/tools/thumby?url=https://www.gravatar.com/avatar/5fefc19b7875e951c7ea9bfdfc06676d&size=200"

7.2. Misc

8. Dokumentation

Diese Dokumentation ist mit asciidoc geschrieben und wurde mit asciidoctor in HTML übersetzt. Dazu wurde das foundation.css Stylesheet aus dem asciidoctor-stylesheet-factory Repository verwendet.

Die Schritte, um an der Doku zu arbeiten sind folgenden

8.1. Dieses Repo herunterladen

git clone https://github.com/jschnasse/Regal

8.2. Asciidoctor und Asciidoctor-Stylesheets installieren

gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | sudo bash -s stable --ruby
#login again
sudo apt-get install bundler
sudo apt-get install gem
git clone https://github.com/asciidoctor/asciidoctor
git clone https://github.com/asciidoctor/asciidoctor-stylesheet-factory
cd asciidoctor
sudo gem install asciidoctor
cd ../asciidoctor-stylesheet-factory
bundle install
compass compile

8.3. Doku modifizieren und in HTML übersetzen

cd Regal/doc
editor api.asciidoc
asciidoctor -astylesheet=foundation.css -astylesdir=../../asciidoctor-stylesheet-factory/stylesheets api.asciidoc

9. License

10. References

regal-scripts vagrant