Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Status
subtletrue
colourRed
title404
 Not Found

  AnchorCreate Node With Named PathCreate Node With Named Path

...

Status
colourBlue
titlePOST
 Create a new automatically-named child node or datastream at the given pathCreate a new child node at the given path.

 

Query Parameters:

Status
subtletrue
titlechecksum
 (Optional) Provide a SHA-1 checksum which will be checked against the uploaded content to ensure error-free transfer.

Status
subtletrue
titlemixin
 (Optional; values: fedora:object, fedora:datastream) Explicitly create an object or datastream, instead of inferring it from the request body body.

Request Headers:

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

Example (1):

Code Block
curl -X POST "http://localhost:8080/rest/"

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/some/path/to/a/new/resource

Example (2):

Code Block
curl -X POST "http://localhost:8080/rest/?mixin=fedora:datastream" # Create a fedora:datastream

Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title409
Conflict (resource is locked)

 

Status
colourBlue
titlePOST
 Create a new node as a child of the given node

If the given resource path exists, a POST to that path will create a new node as a child of the given resource using a generated identifier.

Request Headers:

Status
subtletrue
titleSlug
  Use the slug header when creating the new resource (see AtomPub slug header). If no slug is provided, the identifier will be automatically generated.

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

Note

The slug you provide does not guarantee the location of the created node. Clients must check the Location header for the path to the created resource. For full control over the generated path, see POST Create a new node at the given path.

Query Parameters:

Status
subtletrue
titlemixin
 (Optional; values: fedora:object, fedora:datastream) Explicitly create an object or datastream, instead of inferring it from the request body 

Example (1):

Code Block
curl -X POST -H "Slug: new-node-name" "http://localhost:8080/rest/"

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/new-node-name"

Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title409
Conflict (resource is locked)

 

 

Status
colourBlue
titlePOST
  Create a new node and populate some properties

In addition to creating a new node, add the given properties to the object

Note

An RDF payload can be combined with any of the above forms.

Note

RDF will be interpreted using the current resource as the base URI (e.g. <> will be expanded to the current URI). Namespaces must be declared in full.

Request Headers:

Status
subtletrue
titleContent-Type
  text/turtle

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

Query Parameters:

Status
subtletrue
titlechecksum

 

Example:

Code Block
curl -X POST -H "Content-Type: text/turtle" --data-binary "@body.rdf" "http://localhost:8080/rest/node/to/create"
 
Request Body:
PREFIX dc: <http://purl.org/dc/elements/1.1/>
<> dc:title "some-resource-title"
 

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/node/to/create

 

Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title409
Conflict (resource is locked)

 

 

Status
colourBlue
titlePOST
 Create a new node and execute a SPARQL-Update query

In addition to creating a new node, execute a SPARQL-Update query against the newly created node. 

Request Headers:

Status
subtletrue
titleContent-Type
  application/sparql-update

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

Query Parameters:

Status
subtletrue
titlechecksum

Note

RDF will be interpreted using the current resource as the base URI (e.g. <> will be expanded to the current URI)

 

Example:

Code Block
curl -X POST -H "Content-Type: application/sparql-update" --data-binary "@body.rdf" "http://localhost:8080/rest/node/to/create"
 
Request Body:
 
PREFIX dc: <http://purl.org/dc/elements/1.1/>
INSERT {   
  <> dc:title "some-resource-title" .
}
WHERE { }
 

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/node/to/create

 

Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title409
Conflict (resource is locked)

 

Status
colourBlue
titlePOST
  Create a new resource with binary content

Note

If the binary content is RDF or a SPARQL-Update query, see Binary Content for an alternative way to create content

Query Parameters:

Status
subtletrue
titlechecksum
 Checksum of the binary content (in the form urn:sha1:<sha-hash>). If the checksum doesn't match, an error will be returned.

 

Header Parameters:

Status
subtletrue
titleContent-DISPOSITION
 The filename provided in the content disposition header will be stored in a premis:hasOriginalName property.

Lock-Token (Optional) a Lock-Token for any locks previously created on resources updated by this operation

 

Example (1):

 

Status
subtletrue
titleContent-Disposition
(Optional) The filename provided in the content disposition header will be stored in a premis:hasOriginalName property.

 

Status
subtletrue
titleContent-Type
(Optional) MIME type of the uploaded datastream or RDF content.

Note

If the MIME type corresponds to a supported RDF format or SPARQL-Update, the uploaded content will be parsed as RDF and used to populate the child node properties.  RDF will be interpreted using the current resource as the base URI (e.g. <> will be expanded to the current URI). Namespaces must be declared in full.

For other MIME types, the uploaded content will be used to create a datastream.

 

Status
subtletrue
titleLock-Token
(Optional) A Lock-Token for any locks previously created on resources updated by this operation.

 

Status
subtletrue
titleSLUG
(Optional) A suggested name for the new child resource, which the repository may ignore.

Note

The slug you provide does not guarantee the location of the created node. Clients must check the Location header for the path to the created resource. For full control over the generated path, see XXX.

 

Example (1): Create a new child node

Code Block
curl -X POST "http://localhost:8080/rest/"

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/some/path/to/a/new/resource


Example (2): Create a new child datastream

Code Block
curl -X POST "http://localhost:8080/rest/?mixin=fedora:datastream" # Create a fedora:datastream


Example (3): Create a new node with RDF properties

Code Block
curl -X POST -H "Content-Type: text/turtle" --data-binary "@body.rdf"
Code Block
curl -X POST --upload-file picture.jpg "http://localhost:8080/rest/binary/resource/to/create"/"
 
Request Body:
PREFIX dc: <http://purl.org/dc/elements/1.1/>
<> dc:title "some-resource-title" 

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/binarynew/resource/to/create/fcr:contentnode/uri


Example (24): Uploaded file with checksum

Code Block
curl -X POST --data-binary "@picture.jpg" "http://localhost:8080/rest/binary/resource/to/createparent/object?checksum=urn:sha1:cb1a576f22e8e3e110611b616e3e2f5ce9bdb941"

...

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/binary/resource/to/createparent/object/auto/generated/ds/id/fcr:content


Example (35): Uploaded file with checksum mismatch

Code Block
curl -X POST --data-binary "@picture.jpg" "http://localhost:8080/rest/binary/resource/to/createparent/object?checksum=urn:sha1:checksumdoesntmatch"

...

Note

By convention, binary content is accessed using the REST endpoint path/to/resource/fcr:content.


Status:

Status
subtletrue
colourGreen
title201
 Created

Status
subtletrue
colourRed
title409404
 Conflict (checksum mismatch Not Found (resource does not exist – use PUT to specify a new resource name)

Status
subtletrue
colourRed
title409
Conflict (resource is locked or checksum mismatch)

 

...

 

Status
colourYellow
titlePUT
 Modify the triples associated with the resource

...