[Cubicweb] Pyramid and REST

Nicolas Chauvat nicolas.chauvat at logilab.fr
Fri May 15 22:05:45 CEST 2015


Hello Rabah,

On Tue, May 12, 2015 at 10:07:40AM +0200, Rabah Meradi wrote:
> I have made a report (attached file) that show how Cubicweb handle the
> different HTTP methods (GET, POST, PUT, DELETE, HEAD and Options) when
> using pyramid.
> [...]
> we don't respect REST architecture (ex: doing a GET to add a resource).

It is nice to see someone working on this.

1) Here are a few links I suggest you add on your reading list:

  http://www.hydra-cg.com/
  http://www.markus-lanthaler.com/hydra/console/?url=http://www.markus-lanthaler.com/hydra/api-demo/#

  https://cornice.readthedocs.org/en/latest/
  https://pypi.python.org/pypi/pyramid_rest/
  https://pypi.python.org/pypi/pyramid_restful_toolkit/

  https://www.cubicweb.org/project/cubicweb-jsonld
  https://www.cubicweb.org/project/cwclientlib

2) Reading the code helped me remember that there is a match_http_method
selection predicate defined in cubicweb/predicates.py, but I can not
find any piece of code that uses it except rqlcontroller/views.py

3) I understand you are looking at js calls first, which is fine, but
I think it will be interesting to look at forms too. Although
http://www.w3.org/TR/html5/forms.html#attr-fs-method says there are
only two possible methods for forms (GET and POST), a bit of
javascript could help (for example, instead of POSTing the
form in vid=deleteconf, I suppose we could send a DELETE via js).

I will see you on tuesday. Let us discuss that together with Sylvain.

-- 
Nicolas Chauvat

logilab.fr - services en informatique scientifique et gestion de connaissances  



More information about the Cubicweb mailing list