On Monday, August 10, 2015 at 11:41:44 AM UTC-7, David Ripplinger wrote:
>
> Here's an update after I learned some more:
>
> It looks like I can have the best of both worlds, since web2py has routers 
> that can translate between a public URL and a back-end URL (see the 
> subsection titled URL Rewrite 
> <http://web2py.com/books/default/chapter/29/04/the-core#URL-rewrite> in 
> the book). My plan is to use URLs in my API such as /object_a, /object_a/1, 
> /object_a/1/info, and /object_a?type=1 along with the various HTTP methods, 
> then use the router to translate these to the appropriate controllers' URLs.
>

I'm exploring RESTfulness myself, slowly.  (I have some SOAP and JSONRPC 
services already, but I need to translate some things for external tools.)

Here's an example from RedHat.

POST /api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains 
HTTP/1.1
POST 
/api/datacenters/d70d5e2d-b8ad-494a-a4d2-c7a5631073c4/storagedomains/fabe0451-701f-4235-8f7e-e20e458819ed/activate
 
HTTP/1.

In the book, "api" would be the action name, and "GET", "POST", etc would 
be function names (covers the first part of the example),
and the rest of the URL would be treated as arguments.  The second part of 
the example includes an extra verb ("activate"), but I guess that would be 
a subcase of the POST verb, based on processing the args.

(The book does use the router, but mainly to hide the controller name (in 
web2py, the file that holds the actions)

As I said, I'm still trying to absorb some of this myself.

/dps


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to