Designing The Protocol

General

Resource URI Method Description
Comment List /comments/ GET Retrieve a list of comment
POST Create a new comment
Comment /comments/{comment-id} GET Retrieve a comment
PUT Update a comment
DELETE Remove a comment
Author List /authors/ GET Retrieve a list of all authors
POST Create a new author
Author /authors/{author-url} GET Retrieve an author
PUT Update an author
DELETE Remove an author

Modifying comments

Post a new comment

URI /comments/
Method POST
Returns 200 OK text/n3

Example

  POST /blog/comments HTTP/1.1
  Host: example.org
  Content-Type: text/n3

  @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
  @prefix an: <http://www.w3.org/2000/10/annotation-ns#> .
  @prefix foaf: <http://xmlns.com/foaf/0.1/> .
  @prefix dc: <http://purl.org/dc/elements/1.1/> .

  [ a an:Annotation, an:Comment;
    an:annotates <http://example.org/blog/2007/03/02-postslug>;
    dc:creator [a foaf:Person; 
      foaf:name "John Doe" ];
    dc:created "2007-03-03";
    an:body <http://doe.org/john/comments/AE8M4> ] .
  HTTP/1.1 201 Created
  Location: http://example.org/blog/comment/3ACF6D754
  Content-Type: text/n3

  @prefix an: <http://www.w3.org/2000/10/annotation-ns#> .

  <http://example.org/blog/comment/3ACF6D754> a an:Annotation, an:Comment;
    an:annotates <http://example.org/blog/2007/03/02-postslug>;
    an:body <http://doe.org/john/comments/AE8M4> . 

Getting comments

Get all comments

URI /comments/
Method GET
Querystring dt= Filter by date
start= The number of the first comment to return
end= The number of the last comment to return
annotates= The annoted URL
Returns 200 OK text/n3404 Not Found

text/n3

Get info on a specific comment

URI /comments/{comment-id}
Method GET
Returns 200 OK text/n3 404 Not Found

Example :

text/n3
@prefix : <http://example.org/ns/co#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .

<http://example.org/blog/comments/3ACF6D756>  a :Comment;
  :annotates <http://example.org/blog/2007/02/postslug>;
  dc:created "2007-03-03T12:10Z";
  :author  [
    a foaf:Person;
    foaf:name "John Doe" ];
    rdf:seeAlso <http://example.org/blog/authors/5Z7DE>,
          <http://john.org/foaf.rdf>;
  :body  """<p>Comment here</p>""" .

Delete a comment

URI /comments/{comment-id}
Method DELETE
Returns 200 OK 404 Not Found

Getings author


Created by Maruku at 14:16 on Sunday, March 04th, 2007.