...
These examples are for a Fedora hands-on workshop and are referenced by these slides. All examples are displayed below in a curl command-line form. For those who do not have curl or prefer a graphical interface, the examples can be obtained as a JSON import file for the POSTMan REST client.
...
Linked Data Platform
Create the Pythagoras collection
Request URI: POST http://localhost:8080/rest/pythagoras
MethodCURL Command: GET
Headers:
Status | ||||
---|---|---|---|---|
|
Example:
Code Block |
---|
curl "http://localhost:8080/rest/fcr:nodetypes" |
Response:
Code Block |
---|
Status: 200 OK
Headers:
Accept: text/turtle
|
Status:
Status | ||||||
---|---|---|---|---|---|---|
|
GET Portrait Container
Code Block |
---|
curl -X POST -H "Slug: pythagoras" -H "Content-Type: text/turtle" -H "Accept: text/turtle" --data-binary "@request-body.ttl" |
...
http://localhost:8080/rest/ |
...
Method: GET
Status title GET
get a list of registered types (as RDFS triples)
title | GET |
---|
Request
Request Headers:
Status | ||||
---|---|---|---|---|
|
Example:
Code Block |
---|
curl "http://localhost:8080/rest/fcr:nodetypes" |
Response:
Code Block |
---|
Status: 200 OK
Headers:
Accept: text/turtle
|
Status:
|
request-body.ttl
Code Block |
---|
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<> dc:title 'Pythagoras Collection';
dc:abstract 'A collection of materials and facts about Pythagoras' .
|
...
Add Pythagoras the Person
Status | ||||||
---|---|---|---|---|---|---|
|
Add Pythagoras the Person
Request URI: POST http://localhost:8080/rest/pythagoras/
Method: POST
Status title GET
get a list of registered types (as RDFS triples)
title | GET |
---|
Request
Request Headers:
Status | ||||
---|---|---|---|---|
|
Example:
Code Block |
---|
curl "http://localhost:8080/rest/fcr:nodetypes" |
Response:
CURL Command:
Code Block |
---|
curl -X POST -H "Slug: person" -H " |
Code Block |
Status: 200 OK Headers: Slug: person Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"" -H "Content-Type: text/turtle" --data-binary "@request-body.ttl" http://localhost:8080/rest/pythagoras/ |
request-body.ttl
Code Block |
---|
Body:
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<> a foaf:Person;
foaf:name 'Pythagoras' ;
foaf:based_near "Croton" ;
foaf:interest [ dc:title "Geometry" ] .
|
Status:
Status | ||||||
---|---|---|---|---|---|---|
|
POST Portrait Container
...
Get Pythagoras collection
Request URI: GET http://localhost:8080/rest/pythagoras
MethodCURL Command: POST
Status title GET
get a list of registered types (as RDFS triples)
title | GET |
---|
Request
Request Headers:
Status | ||||
---|---|---|---|---|
|
Example:
...
Code Block |
---|
curl -X GET -H "Accept: text/turtle" http://localhost:8080/rest/pythagoras
|
...
POST Portrait Container
...
POST
...
CURL CommandResponse:
Code Block |
---|
Status: 200 OK Headers: curl -X POST -H "Content-Type: text/turtle " -H "Slug: portraits" --data-binary "@request-body.ttl" http://localhost:8080/rest/pythagoras |
request-body.ttl
Code Block |
---|
Body:
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<> a ldp:DirectContainer;
ldp:membershipResource </rest/pythagoras/person>;
ldp:hasMemberRelation foaf:depiction;
dcterms:title "Portraits of Pythagoras" .
|
Status:
...
...
subtle | true |
---|---|
colour | Green |
title | 200 |
...
POST a Portrait
Request URI: POST http://localhost:8080/rest/pythagoras/portraits
Method: POST
Status title GET
get a list of registered types (as RDFS triples)
title | GET |
---|
Request
Request Headers:
Status | ||||
---|---|---|---|---|
|
ExampleCURL Command:
Code Block |
---|
curl "http://localhost:8080/rest/fcr:nodetypes" |
Response:
Code Block |
---|
Status: 200 OK Headers: -X POST -H "link: <http://www.w3.org/ns/ldp#Resource>; rel="type"" -H " Content-Type: image/jpeg |
Status:
Status | ||||||
---|---|---|---|---|---|---|
|
POST List of Pythagoras' Influences
" http://localhost:8080/rest/pythagoras/portraits
|
...
GET Portrait Container
Request URI: GET http://localhost:8080/rest/pythagoras/portraits
MethodCURL Command: POST
Status title GET
get a list of registered types (as RDFS triples)
title | GET |
---|
Request
Request Headers:
Status | ||||
---|---|---|---|---|
|
Example:
Code Block |
---|
curl -X GET -H "Accept: text/turtle" http://localhost:8080/rest/pythagoras/portraits
|
...
GET Pythagoras Person
GET http://localhost:8080/rest/pythagoras/person
CURL Command:
Code Block |
---|
curl -X GET -H "Accept: text/turtle" |
Code Block |
curl "http://localhost:8080/rest/fcr:nodetypes"/pythagoras/person |
...
POST List of Pythagoras' Influences
POST http://localhost:8080/rest/pythagoras/
CURL CommandResponse:
Code Block |
---|
Status: 200 OK Headers: curl -X POST -H "Content-Type: text/turtle " -H "Slug: influences" --data-binary "@request-body.ttl" http://localhost:8080/rest/pythagoras/ |
request-body.ttl
Code Block |
---|
Body:
@prefix ldp: <http://www.w3.org/ns/ldp#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ph: <http://example.org/vocab/philosophy#> .
<> a ldp:IndirectContainer;
ldp:membershipResource <http://localhost:8080/rest/pythagoras/person>;
ldp:hasMemberRelation foaf:knows;
ldp:insertedContentRelation foaf:primaryTopic;
dcterms:title "List of People that Influenced Pythagoras" .
|
Status:
Status | ||||||
---|---|---|---|---|---|---|
|
GET Pythagoras Person
...
Add Thales as Influence
Request URI: POST http://localhost:8080/rest/pythagoras/person
Method: GET
Status title GET
get a list of registered types (as RDFS triples)
title | GET |
---|
Request
Request Headers:
Status | ||||
---|---|---|---|---|
|
CURL CommandExample:
Code Block |
---|
curl "http://localhost:8080/rest/fcr:nodetypes" |
Response:
Code Block |
---|
Status: 200 OK
Headers:
Accept: text/turtle
|
Status:
Status | ||||||
---|---|---|---|---|---|---|
|
Add Thales as Influence
...
-X POST -H "Slug: thales" -H "Content-Type: text/turtle" --data-binary "@request-body.ttl" http://localhost:8080/rest/pythagoras/influences/ |
...
|
request-body.ttl
Code Block |
---|
Method: POST
Status title GET
get a list of registered types (as RDFS triples)
title | GET |
---|
Request
Request Headers:
Status | ||||
---|---|---|---|---|
|
Example:
Code Block |
---|
curl "http://localhost:8080/rest/fcr:nodetypes" |
Response:
Code Block |
---|
Status: 200 OK
Headers:
Slug: thales
Content-Type: text/turtle
Body:
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<> dcterms:title "Thales";
foaf:primaryTopic <http://en.wikipedia.org/wiki/Thales> .
|
Status:
Status | ||||||
---|---|---|---|---|---|---|
|
...
GET List of Influences
GET http://localhost:8080/rest/pythagoras/influences
CURL Command:
Code Block |
---|
curl -X GET -H "Accept: text/turtle" --data-binary "@request-body.ttl" http://localhost:8080/rest/pythagoras/influences
|
request-body.ttl
Code Block |
---|
|