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

Compare with Current View Page History

« Previous Version 16 Next »

Table of Contents

REST API docs

General principles

Content

Location

search objects

GET/objects

nextPid

POST /objects/nextPid

Object

GET/DELETE/POST/PUT /objects/{pid}

Object Export

GET /objects/{pid}\export

Object Versions

GET /objects/{pid}\versions

Object XML

GET /objects/{pid}\objectXML

Datastreams

GET/objects/{pid}/datastreams

Specific datastream

GET/DELETE/PUT/POST /objects/{pid}/datastreams/{dsID}

content of Datastream

GET/objects/{pid}/datastreams/{dsID}/content

List Methods on Object

GET/objects/{pid}/methods

list methods for sdef on Object

GET/objects/{pid}/methods/{sdef}

get-invoke method

GET/objects/{pid}/methods/{sdef}/{method}

Repository Resources

Object Resources

GET /objects/{pid} - get object profile

GET /objects/{pid}?[asOfDateTime][format]

Parameter

Format

Meaning

Default

Example

asOfDateTime

yyyy-MM-ddTHH:mm:ss.SSSZ

The object, as it looked at the specified time

Now

2009-01-01T03:00:00:000Z

format

one of text/xml, text/html, html, xml

The format of the return value

text/html

text/xml

Profile of an object, which includes key metadata fields and URLs for the object Dissemination Index and the object Item Index. Can be thought of as a default view of the object.

Return code

Meaning

200

OK, returning the object profile as body, see below

404

Object not found in repository. Body is exception as text/plain

401

Unauthorized, the security policy forbade this operation with the supplied user credentials. Body as exception as text/plain

400

Wrong syntax in request, most likely from format or asOfDateTime. Exception as body, text/plain

500

Other, unknown error encountered

  • ObjectProfile Contains these fields
    • String pid The pid of the object
    • String objLabel The label of the object
    • String objOwnerID The ownerID of the object
    • String[] objModels The pids of the content models of the object
    • String objCreateDate The creation date
    • String objLastModDate The last modification time
    • String objDissIndexViewURL The REST url for the Dissemination index, as known from the built in search service
    • String objItemIndexViewURL The REST url for the Datastream index, as known from the built in search service
    • String objState The object state, either A (active), I (inactive) or D (deleted)

Examples:
Get the object profile of the object as it looked at the specified date in the xml format
GET /objects/{pid}?asOfDateTime=2009-01-01T03:00:00:000Z&format=text/xml

Example of html format

TODO

Example of xml format

Without asOfDateTime set
<objectProfile pid="demo:testObject">
  <objLabel>label</objLabel>
  <objOwnerId>fedoraAdmin</objOwnerId>
  <objModels>
    <model>info:fedora/demo:ContentModel</model>
  </objModels>
  <objCreateDate>2008-09-29T03:49:450Z</objCreateDate>
  <objLastModDate>2014-09-19T01:18:330Z</objLastModDate>
  <objDissIndexViewURL>http://localhost:8080/fedora/get/demo:testObject/fedora-system:3/viewMethodIndex</objDissIndexViewURL>
  <objItemIndexViewURL>http://localhost:8080/fedora/get/demo:testObject/fedora-system:3/viewItemIndex</objItemIndexViewURL>
  <objState>A</objState>
</objectProfile>
With asOfDateTime set
<objectProfile pid="demo:testObject" datetime="2008-09-29T03:49:450Z">
  <objLabel>label</objLabel>
  <objOwnerId>fedoraAdmin</objOwnerId>
  <objModels>
    <model>info:fedora/demo:ContentModel</model>
  </objModels>
  <objCreateDate>2008-09-29T03:49:450Z</objCreateDate>
  <objLastModDate>2014-09-19T01:18:330Z</objLastModDate>
  <objDissIndexViewURL>http://localhost:8080/fedora/get/demo:testObject/fedora-system:3/viewMethodIndex/2008-09-29T03:49:450Z</objDissIndexViewURL>
  <objItemIndexViewURL>http://localhost:8080/fedora/get/demo:testObject/fedora-system:3/viewItemIndex/2008-09-29T03:49:450Z</objItemIndexViewURL>
  <objState>A</objState>
</objectProfile>
Schema for XML return value
<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSPY v2004 rel. 2 U (http://www.xmlspy.com)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
	elementFormDefault="qualified">
	<xs:element name="objectProfile">
		<xs:complexType>
			<xs:sequence>
				<xs:element ref="objLabel" />
				<xs:element ref="objOwnerId" />
				<xs:element ref="objModels" />
				<xs:element ref="objCreateDate" />
				<xs:element ref="objLastModDate" />
				<xs:element ref="objDissIndexViewURL" />
				<xs:element ref="objItemIndexViewURL" />
				<xs:element ref="objState" />
			</xs:sequence>
			<xs:attribute name="pid" use="required">
				<xs:simpleType>
					<xs:restriction base="xs:string" />
				</xs:simpleType>
			</xs:attribute>
			<xs:attribute name="datetime" use="optional">
				<xs:simpleType>
                                        <xs:restriction base="xs:dateTime" />
				</xs:simpleType>
			</xs:attribute>

		</xs:complexType>
	</xs:element>
	<xs:element name="objCreateDate">
		<xs:simpleType>
			<xs:restriction base="xs:dateTime" />
		</xs:simpleType>
	</xs:element>
	<xs:element name="objDissIndexViewURL">
		<xs:simpleType>
			<xs:restriction base="xs:anyURI" />
		</xs:simpleType>
	</xs:element>
	<xs:element name="objItemIndexViewURL">
		<xs:simpleType>
			<xs:restriction base="xs:anyURI" />
		</xs:simpleType>
	</xs:element>
	<xs:element name="objLabel">
		<xs:simpleType>
			<xs:restriction base="xs:string" />
		</xs:simpleType>
	</xs:element>
    <xs:element name="objOwnerId">
        <xs:simpleType>
            <xs:restriction base="xs:string" />
        </xs:simpleType>
    </xs:element>
	<xs:element name="objModels">
		<xs:complexType>
			<xs:sequence>
				<xs:element name="model" minOccurs="0" maxOccurs="unbounded" type="xs:string" />
			</xs:sequence>
		</xs:complexType>
	</xs:element>
	<xs:element name="objLastModDate">
		<xs:simpleType>
			<xs:restriction base="xs:dateTime" />
		</xs:simpleType>
	</xs:element>
    <xs:element name="objState">
        <xs:simpleType>
            <xs:restriction base="xs:string" />
        </xs:simpleType>
    </xs:element>	
</xs:schema>

DELETE /objects/{pid} - purge object

DELETE /objects/{pid}?[logMessage][force]

Parameter

Format

Meaning

Default

Example

logMessage

String

The message to store in the log, about the purge

Empty string

"Deleted this object because it was not used anymore"

force

one of true, false

Force the purge, even it it breaks a data contract. If set to true, the request will fail, a general exception will be thrown and the return code will be 500

false

false

Permanently removes an object from the repository.

Return code

Meaning

200

OK, purging the object, no return body

404

Object not found in repository. Body is exception as text/plain

401

Unauthorized, the security policy forbade this operation with the supplied user credentials. Body as exception as text/plain

400

Wrong syntax in request. Exception as body, text/plain

500

Other, unknown error encountered

POST /objects/{pid} - ingest or create new object

PUT /objects/{pid} - modify object

PUT /objects/{pid}?[label][logMessage][ownerId][state]

Modify an object. Modifies only the object level properties, ie. label, ownerId and state.

Parameter

Format

Meaning

Default

Example

label

String

The new object label

no change

"My object"

logMessage

String

The message to store in the log, about the purge

Empty string

"Deleted this object because it was not used anymore"

ownerID

String

The new owner id

no change

"FedoraAdmin"

state

String, one of A (active), I (inactive) or D (deleted)

The new object state. Note that if you do not set this parameter, the default value will set the object to Active

A

D

Return code

Meaning

200

OK, Modifying the object, no return body

404

Object not found in repository. Body is exception as text/plain

401

Unauthorized, the security policy forbade this operation with the supplied user credentials. Body as exception as text/plain

400

Wrong syntax in request. Exception as body, text/plain

500

Other, unknown error encountered

GET /objects/{pid}\export

GET /objects/{pid}\versions

GET /objects/{pid}\objectXML

Datastream Resources

2. Method Resources

Create methods

Object resources

Create new object with given pid

PUT /objects/{pid}

Return: Nothing or pid of the new object

Creates a new, empty object

Create new object with autogenerated pid

POST /objects/

Return: pid of the new object (/objects/demo:newObject2)

Creates a new, empty object

Datastream resources

Create a new datastream

PUT /objects/{pid}/datastreams/{dsID}[/withControlGroup/{cg}]

Creates a new datastream in the object with controlgroup X or {cg} if specified. Datastream is empty.

Retrieve methods

Object resources

Present Object

GET /objects/{pid}

Return: XML that presents the object....

Undetailed

Get the object properties

GET /objects/{pid}/properties
Return: list of property names (/object/demo:myPid2/properties/label)

Provides a list of property names that can be queried

Get a specific object property

GET /objects/{pid}/properties/{property}
Return: The value

Give the value of the specific property, or 404 if property not found

Example: /objects/demo:myPid2/properties/label

Get content models for a object

GET /objects/{pid}/contentmodels
Return: Get the content models of the object (/objects/demo:contentmodel)

Get a list of the content models of this object

Get all the relations of an object

GET /objects/{pid}/relations
Return: Return a list of relation names

Get a specific relation from an object

GET /objects/{pid}/relations/{rel-name}
Return: List of pids of objects referred by this relation

List the methods on an object

GET /objects/{pid}/methods
Return: a list of objects

Invoke a method on an object

GET/POST /objects/{pid}/methods/{sdef}/{methodName}?params

Datastream resources

Get Contents of a datastream

GET /objects/{pid}/datastreams/{dsID}

Get the properties of a datastream

GET /objects/{pid}/datastreams/{dsID}/properties

Get a specific property of a datastream

GET /objects/{pid}/datastreams/{dsID}/properties/{prop}
Return: The value

Get the relations of the datastream

GET /objects/{pid}/datastreams/{dsID}/relations

The RELS-INT block "about" this datastream

Get version timestamps of a datastream

The idea is that the old version of the datastream should support the same getter methods as the current version

GET /objects/{pid}/datastreams/{dsID}/versions

Get the contents of a specific version of a datastream

GET /objects/{pid}/datastreams/{dsID}/versions/{timestamp}/contents

Get the versioned properties of a specific version

GET /objects/{pid}/datastreams/{dsID}/versions/{timestamp}/properties

Get a specific versioned property of a specific version

GET /objects/{pid}/datastreams/{dsID}/versions/{timestamp}/properties/{propertyname}

Get the relations of a specific version

GET /objects/{pid}/datastreams/{dsID}/versions/{timestamp}/relations/

Update methods

Object resources

Write a specific property

PUT /objects/{pid}/properties/{property}
Contents: The new value
Return nothing, or 404 if property not found. New properties cannot be created.

Add a relation to an object

PUT /objects/{pid}/relations/{rel-name}/to/{objpid}

Add a content model to this object

PUT /objects/{pid}/contentmodels/{cmpid}
Contents: Nothing

Add cmpid to the list of content model for this object

Add a literal relation

PUT /objects/{pid}/relations/{rel-name}/toLiteral/{value}[/withType/{type}]

Datastream resources

Update the contents of an Inline Datastream

POST /objects/{pid}/datastreams/{dsID}/contents
Contents: The new content of the datastream

Update a datastream property

PUT /objects/{pid}/datastreams/{dsID}/properties/{prop}
Contents: The new value

examples: versionable, state and so on.

Update an External, managed or Redirect Datastream

Contentlocation is just a property of these datastreams

PUT /objects/{pid}/datastreams/{dsID}/properties/contentLocation
Contents: The URL to the contents of the datastream

Add a relation to the datastream

PUT /objects/{pid}/datastreams/{dsID}/relations/{rel-name}/to/{objPid}

Add a literal relation to the datastream

PUT /objects/{pid}/datastreams/{dsID}/relations/{rel-name}/toLiteral/{value}[/withType/{type}]

Delete methods

Object resources

Purge object

DELETE /objects/{pid}

Remove a content model from this object

DELETE /objects/{pid}/contentmodels/{cmpid}
Contents: Nothing

Remove cmpid from the list of content models for this object

Purge a relation to an object

DELETE /objects/{pid}/relations/{rel-name}/to/{objpid}

Delete a literal relation

DELETE /objects/{pid}/relations/{rel-name}/toLiteral/{value}

Datastream resources

Delete a datastream

DELETE /objects/{pid}/datastreams/{dsID}

Purge the datastream from the object from the repository

Purge a relation from the datastream

DELETE /objects/{pid}/datastreams/{dsID}/relations/{rel-name}/to/{objPid}

Purge a literal relation from a datastream

DELETE /objects/{pid}/datastreams/{dsID}/relations/{rel-name}/toLiteral/{value}

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))
  • No labels