Versions Compared

Key

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

...

Request URI: /path/to/some/resource/fcr:datastreamsbatch

Methods: GET, POST, DELETE

...

Query Parameters:

Status
subtletrue
titleDSIDChild
  Identifier for the children with binary content to retrieve (Optional; if omitted, return all binary content children)

...

Code Block
curl "http://localhost:8080/rest/path/to/some/resource/fcr:datastreamsbatch?dsidchild=content&dsidchild=thumbnail"

Response:

Code Block
Status: 200 OK
 
Headers:
ETag: "686897696a7c876b7e"
Content-Type: multipart/form-data; boundary=AaB03x
Content-Length: 123456
Cache-Control: 
Last-Modified-At: 2013-01-01T01:23:45Z
 
Body:
--AaB03x
Content-Disposition: attachment; filename="content"
Content-Type: image/tiff
<binary content>
--AaB03x
Content-Disposition: attachment; filename="thumbnail"
Content-Type: image/jpeg
<binary content>

...

Status
colourBlue
titlePOST
Create (or replace?) multiple binary resources in a single request Bulk creation, modification and deletion of resources with a single multipart request

 

This endpoint supports two different content types, multipart/mixed (preferred) or multipart/form-data (see below).

Request HeadersQuery Parameters:

Status
subtletrue
title
delete List of nodes to remove

Example:

Content-Type
 multipart/mixed

 

In multipart/mixed mode, the content-disposition of each part will determine the behavior of that part. The object-to-be-manipulated is given in the name of the part. The supported content-dispositions are:

  • inline; creates or modifies an object's properties (either by replacing the properties with the supplied RDF, or by executing a SPARQL-Update query)
  • attachment; creates and replaces the binary content of an object
  • delete; deletes an object

Example:

Code Block
# creates (or replaces) three datastreams:
# http://localhost:8080/rest/path/to/some/resource/a
# http://localhost:8080/rest/path/to/some/resource/b
# http://localhost:8080/rest/path/to/some/resource/c
curl -X POST -H "Content-Type: multipart/mixed; boundary=----" -d @multipart_request "http://localhost:8080/rest/path/to/some/resource/fcr:batch"
Code Block
# content of multipart_request
----
Content-Disposition: attachment; name="a"; filename="img002.jpg"
Content-Type: image/jpeg
<binary content here>
----
Content-Disposition: attachment; name="b"; filename="img003.jpg"
Content-Type: image/jpeg
<binary content here>
----
Content-Disposition: attachment; name="c"; filename="img002.jpg"
Content-Type: image/jpeg
<binary content here>
----

 

Example:

Code Block
# Creates or modifies properties of two objects:
# http://localhost:8080/rest/path/to/some/resource
# http://localhost:8080/rest/path/to/some/resource/a
curl -X POST -H "Content-Type: multipart/mixed; boundary=----" -d @multipart_request "http://localhost:8080/rest/path/to/some/resource/fcr:batch"
Code Block
# content of multipart_request
----
Content-Disposition: inline; name="."
Content-Type: application/sparql-update

INSERT { <> dc:title "abc" } WHERE { }
----
Content-Disposition: inline; name="a"
Content-Type: application/rdf+xml

<> dc:title "xyz"
----

Response:

Code Block
Status: 201 Created

Status:

Status
subtletrue
colourGreen
title201
 

 

 

...

 

Status
colourBlue
titlePOST
 Bulk creation, modification and deletion of resources with a single multipart request

 

Request Headers:

Status
subtletrue
titleContent-Type
 multipart/form-data

For clients unable to produce multipart/mixed requests, a multipart/form-data endpoint is also provided. It uses heuristics to determine which action to apply:

 - if the entity has a supplied filename, it will create a new datastream at the part's name

 - if the content is RDF or SPARQL-Update (and doesn't have a filename set), add or update triples

 - if the entity's name is "delete[]", the content of the body is a relative path to a resource to delete 

  • otherwise, it will create a new datastream at the part's name using the part's content.

 

 

Example:

Code Block
# creates the ds1 resource
curl -X POST  -F "ds1=@image.png" "http://localhost:8080/rest/path/to/some/resource/fcr:batch"
 
# execute the supplied SPARQL-Update query against the resource
curl -
Code Block
# creates the ds1 resource and removes the old-content resource
curl -X POST  -F "ds1=@image.png.=@sparql_update_query;type=application/sparql-update" "http://localhost:8080/rest/path/to/some/resource/fcr:datastreams?delete=old-content"batch"
 
# delete the ds1 resource
curl -X POST  -F "delete[]=ds1" "http://localhost:8080/rest/path/to/some/resource/fcr:batch"
 
# or any combination of the above.

Response:

Code Block
Status: 201 Created

...

Query Parameters:

Status
subtletrue
titledsidchild
 List of child resources to delete

...

Code Block
# removes both old-content and backup-content resources
curl -X DELETE "http://localhost:8080/rest/path/to/some/resource/fcr:datastreamsbatch?dsidchild=old-content&dsidchild=backup-content"

Response:

...