Thanks Christoph and Siddharth for prompt reply. But I have a different cocern. For either format, all the requests from client will be handled by one script. I went throgh Christoph's article: http://baudson.cute-ice.de/serendipity/index.php?/archives/20-RESTful-Web-Service-with-PHP-2.html
Here, Christoph is parsing the URL to identify the resource. So this means that all the URLs are being handled by the same script. I can explain it in verbose. Client sends: GET api/user/id/json Now in general apache server will try to open a page api/user/id/json/index.html or execute the file api/user/id/json.php But we know this is wrong. Actually, there will be a script say api/index.php which will parse the URL api/user/id/json and find the resource and format. So, one way to solve this problem is to map all the urls of the form api/* to api/index.php. This can be done by using mod rewrite. Any other solution? Do I make sense? Normally I don't :-) Regards Vikas On Sun, Jul 11, 2010 at 1:04 PM, Siddharth Prakash Singh <[email protected]>wrote: > Hi Christoph, > > Twitter uses the format like GET user/id.json or GET user/id.xml > > Siddharth > > On Sun, Jul 11, 2010 at 12:54 PM, Christoph Baudson > <[email protected]> wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Hi Vikas, > > > > Vikas Banjara wrote: > >> Hi all, > >> > >> I want a discussion on ways of handling REST API Request. Rest request > URL > >> will be like - > >> GET api/user/id.json or Get api/user/id.xml > >> Now all the requests are handled by one page say api/index.php. So how > are > >> we going to redirect all such request to this index.php. > >> One solution could be Apache rewrite. > >> > >> Is it a good solution? Is it a standard solution? Any other better > solution? > > > > I had studied a book [1] on RESTful Web Services with PHP last year. The > > authors used the following style of representing resources > > > > api/user.php/<id>/json > > > > Not sure if this is the standard way, but I think it's easier to start > > without rewrite rules (more people will join and test). > > > > Read more about it at my blog [2]. > > > > Comments? > > > > Christoph > > > > [1] http://www.packtpub.com/restful-php-web-services/book > > [2] > > > http://baudson.cute-ice.de/serendipity/index.php?/archives/19-RESTful-Web-Service-with-PHP-1.html > > > > > >> > >> Thanks > >> Vikas > >> > >> > >> > >> ------------------------------------------------------------------------ > >> > >> _______________________________________________ > >> Mapbender_dev mailing list > >> [email protected] > >> http://lists.osgeo.org/mailman/listinfo/mapbender_dev > > > > -----BEGIN PGP SIGNATURE----- > > Version: GnuPG v1.4.9 (GNU/Linux) > > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > > > > iEYEARECAAYFAkw5cZUACgkQGtMIfbycMX41oACgkY315VrU8pWggW8Ft/xiXosZ > > sLcAoNMnFgYenHuD6kp6T1vqOqVoLPea > > =yKaL > > -----END PGP SIGNATURE----- > > _______________________________________________ > > Mapbender_dev mailing list > > [email protected] > > http://lists.osgeo.org/mailman/listinfo/mapbender_dev > > > > > > -- > Siddharth Prakash Singh > http://www.spsneo.com > _______________________________________________ > Mapbender_dev mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/mapbender_dev >
_______________________________________________ Mapbender_dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/mapbender_dev
