Thanks Christoph and Siddharth for prompt reply. <br><br>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: <meta http-equiv="content-type" content="text/html; charset=utf-8"><a href="http://baudson.cute-ice.de/serendipity/index.php?/archives/20-RESTful-Web-Service-with-PHP-2.html">http://baudson.cute-ice.de/serendipity/index.php?/archives/20-RESTful-Web-Service-with-PHP-2.html</a><br>
<br>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. <br><br>Client sends: GET api/user/id/json<br>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 <br>
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.<br><br>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. <br>
Any other solution? Do I make sense? Normally I don't :-)<br><br>Regards<br>Vikas<br><br><div class="gmail_quote">On Sun, Jul 11, 2010 at 1:04 PM, Siddharth Prakash Singh <span dir="ltr"><<a href="mailto:spsneo@gmail.com">spsneo@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Christoph,<br>
<br>
Twitter uses the format like GET user/id.json or GET user/id.xml<br>
<br>
Siddharth<br>
<div><div></div><div class="h5"><br>
On Sun, Jul 11, 2010 at 12:54 PM, Christoph Baudson<br>
<<a href="mailto:christoph@baudson.de">christoph@baudson.de</a>> wrote:<br>
> -----BEGIN PGP SIGNED MESSAGE-----<br>
> Hash: SHA1<br>
><br>
> Hi Vikas,<br>
><br>
> Vikas Banjara wrote:<br>
>> Hi all,<br>
>><br>
>> I want a discussion on ways of handling REST API Request. Rest request URL<br>
>> will be like -<br>
>> GET api/user/id.json or Get api/user/id.xml<br>
>> Now all the requests are handled by one page say api/index.php. So how are<br>
>> we going to redirect all such request to this index.php.<br>
>> One solution could be Apache rewrite.<br>
>><br>
>> Is it a good solution? Is it a standard solution? Any other better solution?<br>
><br>
> I had studied a book [1] on RESTful Web Services with PHP last year. The<br>
> authors used the following style of representing resources<br>
><br>
> api/user.php/<id>/json<br>
><br>
> Not sure if this is the standard way, but I think it's easier to start<br>
> without rewrite rules (more people will join and test).<br>
><br>
> Read more about it at my blog [2].<br>
><br>
> Comments?<br>
><br>
> Christoph<br>
><br>
> [1] <a href="http://www.packtpub.com/restful-php-web-services/book" target="_blank">http://www.packtpub.com/restful-php-web-services/book</a><br>
> [2]<br>
> <a href="http://baudson.cute-ice.de/serendipity/index.php?/archives/19-RESTful-Web-Service-with-PHP-1.html" target="_blank">http://baudson.cute-ice.de/serendipity/index.php?/archives/19-RESTful-Web-Service-with-PHP-1.html</a><br>
><br>
><br>
>><br>
>> Thanks<br>
>> Vikas<br>
>><br>
>><br>
>><br>
>> ------------------------------------------------------------------------<br>
>><br>
>> _______________________________________________<br>
>> Mapbender_dev mailing list<br>
>> <a href="mailto:Mapbender_dev@lists.osgeo.org">Mapbender_dev@lists.osgeo.org</a><br>
>> <a href="http://lists.osgeo.org/mailman/listinfo/mapbender_dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapbender_dev</a><br>
><br>
> -----BEGIN PGP SIGNATURE-----<br>
> Version: GnuPG v1.4.9 (GNU/Linux)<br>
> Comment: Using GnuPG with Mozilla - <a href="http://enigmail.mozdev.org" target="_blank">http://enigmail.mozdev.org</a><br>
><br>
> iEYEARECAAYFAkw5cZUACgkQGtMIfbycMX41oACgkY315VrU8pWggW8Ft/xiXosZ<br>
> sLcAoNMnFgYenHuD6kp6T1vqOqVoLPea<br>
> =yKaL<br>
> -----END PGP SIGNATURE-----<br>
> _______________________________________________<br>
> Mapbender_dev mailing list<br>
> <a href="mailto:Mapbender_dev@lists.osgeo.org">Mapbender_dev@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/mapbender_dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapbender_dev</a><br>
><br>
<br>
<br>
<br>
</div></div><font color="#888888">--<br>
Siddharth Prakash Singh<br>
<a href="http://www.spsneo.com" target="_blank">http://www.spsneo.com</a><br>
</font><div><div></div><div class="h5">_______________________________________________<br>
Mapbender_dev mailing list<br>
<a href="mailto:Mapbender_dev@lists.osgeo.org">Mapbender_dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapbender_dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapbender_dev</a><br>
</div></div></blockquote></div><br>