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

Compare with Current View Page History

« Previous Version 2 Current »

Overview

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.

Get Pythagoras collection

Request URI: http://localhost:8080/rest/pythagoras

Method: GET


Headers:

ACCEPT   application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Status: 200 OK

Headers:
Accept: text/turtle


Status:

200 OK


GET Portrait Container

Request URI: http://localhost:8080/rest/pythagoras/portraits

Method: GET


GET get a list of registered types (as RDFS triples)

Request

Request Headers:

ACCEPT��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Status: 200 OK

Headers:
Accept: text/turtle


Status:

200 OK


Add Pythagoras the Person

Request URI: http://localhost:8080/rest/pythagoras/

Method: POST


GET get a list of registered types (as RDFS triples)

Request

Request Headers:

ACCEPT��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Status: 200 OK

Headers:
Slug: person
Link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
Content-Type: text/turtle


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:

200 OK


POST Portrait Container

Request URI: http://localhost:8080/rest/pythagoras

Method: POST


GET get a list of registered types (as RDFS triples)

Request

Request Headers:

ACCEPT��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Status: 200 OK

Headers:
Content-Type: text/turtle
Slug: portraits


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:

200 OK


POST a Portrait

Request URI: http://localhost:8080/rest/pythagoras/portraits

Method: POST


GET get a list of registered types (as RDFS triples)

Request

Request Headers:

ACCEPT��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Status: 200 OK

Headers:
link: <http://www.w3.org/ns/ldp#Resource>; rel="type"
Content-Type: image/jpeg


Status:

200 OK


POST List of Pythagoras' Influences

Request URI: http://localhost:8080/rest/pythagoras/

Method: POST


GET get a list of registered types (as RDFS triples)

Request

Request Headers:

ACCEPT��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Status: 200 OK

Headers:
Content-Type: text/turtle
Slug: influences


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:

200 OK


GET Pythagoras Person

Request URI: http://localhost:8080/rest/pythagoras/person

Method: GET


GET get a list of registered types (as RDFS triples)

Request

Request Headers:

ACCEPT��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

Status: 200 OK

Headers:
Accept: text/turtle


Status:

200 OK


Add Thales as Influence

Request URI: http://localhost:8080/rest/pythagoras/influences/

Method: POST


GET get a list of registered types (as RDFS triples)

Request

Request Headers:

ACCEPT��application/ld+json, application/n-triples, application/rdf+xml, application/x-turtle, application/xhtml+xml, application/xml, text/html, text/n3, text/plain, text/rdf+n3, text/turtle

Example:

curl "http://localhost:8080/rest/fcr:nodetypes"

Response:

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:

200 OK


  • No labels