islandora rest api

210 views
Skip to first unread message

Aaron Krebeck

unread,
Sep 27, 2017, 10:04:25 AM9/27/17
to islandora
I'm doing some testing with the Islandora Rest API and in working through the great documentation (https://github.com/discoverygarden/islandora_rest) the only thing I found lacking were some actual curl examples for novice users.  I'm attaching a few below, but I also have a question.  I've authenticated, tested a few GET requests, and created a new object.  From there I can modify the DC datastream just fine.  Now I'd like to create (and modify) a RELS-EXT datastream for this object.  I'm running into trouble with that part.  Could someone send a sample curl request for posting/modifying a new RELS-EXT datastream? 

Sample commands:

## Authenticate to Rest API ##
curl --cookie-jar ./cookies.txt -X POST -H "Content-Type: multipart/form-data" -F "name=youradminuser" -F "pass=youradminpass" -F "form_id=user_login" -F "op=Log in" "http://yourislandora.site.org/user/login"
## Describe an Object ##
## Create A New Object ##
curl -b ./cookies.txt -H "Accept: application/json" -X POST "http://auislandora-dev.wrlc.org/islandora/rest/v1/object" -d '{"pid":"enteranamespace:andnumber","label":"Object Name","owner":"fedoraAdmin"}'
## Delete An Object ##
curl -b ./cookies.txt -H "Accept: application/json" -X DELETE "http://auislandora-dev.wrlc.org/islandora/rest/v1/object/enteranamespace:andnumber"

Mark Jordan

unread,
Sep 27, 2017, 10:38:12 AM9/27/17
to isla...@googlegroups.com
Hi Aaron,

Others may have differing points of view, but I'd recommend building a RELS-EXT by defiining relationships rather than ingesting a fully formed datastream.

I have done some preliminary work on a REST ingester application, https://github.com/mjordan/islandora_rest_ingester, that seemed to work as expected when I was developing it, although I haven't put it into production yet. The code that defines relationships via the REST API starts around line 145.

HTH,

Mark
--
For more information about using this group, please read our Listserv Guidelines: http://islandora.ca/content/welcome-islandora-listserv
---
You received this message because you are subscribed to the Google Groups "islandora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to islandora+...@googlegroups.com.
Visit this group at https://groups.google.com/group/islandora.
To view this discussion on the web visit https://groups.google.com/d/msgid/islandora/6f932018-c251-4e21-8b12-dfd94ece5d9e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Aaron Krebeck

unread,
Sep 28, 2017, 3:34:06 PM9/28/17
to islandora
Great, thanks Mark.  I'm attaching a sample curl version of what you suggested below (it worked great, BTW) and another last example for anyone who treads this way again.

## Add a Relationship (if no other relationships exist, this will create a new RELS-EXT datastream) ##
curl -v -b ./cookies.txt -X POST -H "Accept: application/json" -d '{"uri":"info:fedora/fedora-system:def/model#","predicate":"hasModel","object":"islandora:personCModel","type":"uri"}' "http://yourislandora.site.org/islandora/rest/v1/object//relationship"

## Create A New Datastream ##
curl -v -b ./cookies.txt -X POST -H "Content-Type: multipart/form-data" -F "dsid=TN" -F "controlGroup=M", -F "multipart file as request content=@/home/user/thumbnail.jpg" "http://auislandora-dev.wrlc.org/islandora/rest/v1/object/enteranamespace:andnumber/datastream"

Mark Jordan

unread,
Sep 28, 2017, 4:58:50 PM9/28/17
to isla...@googlegroups.com
Hi Aaron,

Great examples. I wonder if DGI would be open to pull requests that added examples to the README?

Mark
Reply all
Reply to author
Forward
0 new messages