Update: http://www.w3.org/Protocols/PEP/ does what I'm looking for. ![]()
I'm throwing this half-baked idea out there for some feedback to see how feasible it might be.
It's basically extending HTTP with directional URI-namespace methods. URI specfic methods could be looked up by a client with HTTPs OPTION method. The returned Allow: response then used to determine what API methods can be performed on any particular resource. URI Namespacing them would allow anyone to create their own documented API that could be looked up manually or auto-discovered and documented with crawlers.
Method naming would indicate in which direction messages are passed with just the .POST and .GET (Input/Output) suffixes? doing away with PUT and DELETE and other keyword methods in favour of directional URI name space methods. Stateless producer/consumer.
eg:
Resource Methods Introspection:
Request:
OPTIONS /people/person HTTP/1.1
Host:example.com
Response:
Allow: GET, POST, OPTIONS, xmlns.com/foaf/0.1/Person.GET, xmlns.com/foaf/0.1/Person.name.POST
In this example the foaf:name documentation section of the spec could be returned on sending a GET to the "http://xmlns.com/foaf/0.1/Person.GET" URI. Or the "xmlns.com/foaf/0.1/Person.GET" method could be called on the resource that returned it, for example:
Request:
xmlns.com/foaf/0.1/Person.GET /people/person HTTP/1.1
Host: example.com
Response:
<foaf:Person>
<foaf:name>Craig</foaf:name>
<foaf:homepage rdf:resource="http://example.com/blog/"/>
</foaf:Person>
Say you wanted to update the foaf:name element for http://example.com/people/person you might use a method that looks like this:
Request:
xmlns.com/foaf/0.1/Person.name.update.POST /people/person HTTP/1.1
Host: example.com
<foaf:name>ENDOVER Craig</foaf:name>
Response:
HTTP/1.1 200 OK
Date: Mon, 20 Nov 2006 14:30:17 GMT
<foaf:name>ENDOVER Craig</foaf:name>
Delete a Person like so:
xmlns.com/foaf/0.1/Person.delete.POST /people/person HTTP/1.1
Performing a straight GET on http://example.com/people/person could return an entire blog whereas the foaf:name method call just returns a the blog owners foaf.
Consider other APIs and a different syntax:
microformats.org/URImethods.hCard.FN.POST /people/person HTTP/1.1
microformats.org/URImethods.hCard.URL.POST /people/person HTTP/1.1
w3c.org.SPARQL.1_0.endpoint.GET /people/person HTTP/1.1
w3c.org.OWL.sameAS.GET /people/person HTTP/1.1
w3c.org.OWL.sameAS.POST /people/person HTTP/1.1
Annote the semantic web?
One thought is that GET/POST may not be ideal. eg. Benjamin Carlyle's SENA internet draft comes to mind
Consumer:
soundadvice.id.au.SENA.SUBSCRIBE.POST
soundadvice.id.au.SENA.NOTIFY.GET
soundadvice.id.au.SENA.NOTIFYPATCH.GET
soundadvice.id.au.SENA.EXPIRE.GET
Producer:
soundadvice.id.au.SENA.SUBSCRIBE.GET
soundadvice.id.au.SENA.NOTIFY.POST
soundadvice.id.au.SENA.NOTIFYPATCH.POST
soundadvice.id.au.SENA.EXPIRE.POST
INBOX / OUTBOX may be a better choice?
Consumer:
soundadvice.id.au.SENA.SUBSCRIBE.OUTBOX
soundadvice.id.au.SENA.NOTIFY.INBOX
soundadvice.id.au.SENA.NOTIFYPATCH.INBOX
soundadvice.id.au.SENA.EXPIRE.INBOX
Producer:
soundadvice.id.au.SENA.SUBSCRIBE.INBOX
soundadvice.id.au.SENA.NOTIFY.OUTBOX
soundadvice.id.au.SENA.NOTIFYPATCH.OUTBOX
soundadvice.id.au.SENA.EXPIRE.OUTBOX
This all seems feasilble to me but I'm only just getting my feet wet with HTTP, so feedback would be greatly appreciated.
Craig.


