Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Prefer --data-binary to -d for cURL arguments when setting request body to the contents of a file

...

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

...

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

...

Example (1):

Code Block
curl -X POST --data-binary "@picture.jpg" "http://localhost:8080/rest/binary/resource/to/create" -d "@picture.jpg"

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/binary/resource/to/create/fcr:content

Example (2):

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

Response:

Code Block
Status: 201 Created
 
Headers:
Location: http://localhost:8080/rest/binary/resource/to/create/fcr:content

Example (3):

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

Response:

Code Block
Status: 409 Conflict
 
Error:
Checksum Mismatch of cb1a576f22e8e3e110611b616e3e2f5ce9bdb941 and urn:sha1:checksumdoesntmatch

...

Example:

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

Response:

Code Block
Status: 204 No Content

 

Status:

Status
subtletrue
colourGreen
title204
 No Content

Status
subtletrue
colourRed
title412
 Precondition Failed

...

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

...