You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Current »

Requires Unix like terminal access.

Requires cURL

 

Below we assume you're running Fedora at http://localhost:8080, be sure to swap out the address with the correct value if you are not running Fedora locally. Here are some basic recipes:

Describe the root Object of the Repository

curl -X GET http://localhost:8080/rest

Get the Response as "application/rdf+json" rather than the default "application/n3"

curl -H "Accept:application/rdf+json" -X GET http://localhost:8080/rest

You can get responses in the following format's:

  • application/n3 (or text/rdf+n3 or text/n3)
  • text/turtle
  • application/n-triples
  • application/rdf+xml
  • application/rdf+json

Create a new Object "test" as a child of the root Object

curl -X POST http://localhost:8080/rest/test?mixin=fedora:object

Now that Object "test" exists we can create a child of "test" using the same command

curl -X POST http://localhost:8080/rest/test?mixin=fedora:object

Ingest a Data-stream

echo "Test Datastream" > test_datastream.txt
curl -d @test_datastream.txt -X POST http://localhost:8080/rest/test/test_datastream\?mixin\=fedora:datastream

Get a Data-streams content

curl -X GET http://localhost:8080/rest/test/test_datastream/fcr:content



Purge a Data-stream

curl -X DELETE http://localhost:8080/rest/test/test_datastream

Add a new property to the "test" Object

echo "PREFIX dc: <http://purl.org/dc/elements/1.1/> INSERT DATA { <http://localhost:8080/rest/test> dc:title 'Test Title' }" > query.txt
curl -d @query.txt -H "Content-Type: application/sparql-update" -X PATCH http://localhost:8080/rest/test/

Please refer to https://wiki.duraspace.org/display/FF/REST+API for more information on what can be done with the REST API and cURL.
And checkout https://wiki.duraspace.org/display/FF/Object+properties+and+SPARQL-UPDATE for how to use the SPARQL update in greater detail.


 

  • No labels