<br><br><div class="gmail_quote">On Sun, Jul 11, 2010 at 2:23 PM, Christoph Baudson <span dir="ltr">&lt;<a href="mailto:christoph@baudson.de">christoph@baudson.de</a>&gt;</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;">
<div class="im">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
</div><div class="im">Vikas Banjara wrote:<br>
&gt; Thanks Christoph and Siddharth for prompt reply.<br>
&gt;<br>
&gt; But I have a different cocern. For either format, all the requests from<br>
&gt; client will be handled by one script. I went throgh Christoph&#39;s article:<br>
&gt; <a href="http://baudson.cute-ice.de/serendipity/index.php?/archives/20-RESTful-Web-Service-with-PHP-2.html" target="_blank">http://baudson.cute-ice.de/serendipity/index.php?/archives/20-RESTful-Web-Service-with-PHP-2.html</a><br>

&gt;<br>
&gt; Here, Christoph is parsing the URL to identify the resource. So this means<br>
&gt; that all the URLs are being handled by the same script. I can explain it in<br>
&gt; verbose.<br>
&gt;<br>
&gt; Client sends: GET api/user/id/json<br>
&gt; Now in general apache server will try to open a page<br>
&gt; api/user/id/json/index.html or execute the file api/user/id/json.php<br>
&gt; But we know this is wrong. Actually, there will be a script say<br>
&gt; api/index.php which will parse the URL api/user/id/json and find the<br>
&gt; resource and format.<br>
&gt;<br>
&gt; So, one way to solve this problem is to map all the urls of the form api/*<br>
&gt; to api/index.php. This can be done by using mod rewrite.<br>
&gt; Any other solution? Do I make sense? Normally I don&#39;t :-)<br>
<br>
</div>You can have a single script for each resource type in the approach I<br>
mentioned. Think of it like this<br>
<br>
api/users.php/json<br>
<div class="im">api/user.php/&lt;id&gt;/json<br>
</div>api/wms.php/&lt;id&gt;/json&gt;<br>
<br>
etc.<br>
<br></blockquote><div><br>Even if it is api/users.php/json<br>when the client will send a request GET api/users/json , the server will look for api/users/json/index.php or api/users/json/index.html<br><br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

So you won&#39;t need any rewriting.<br>
<br>
Christoph<br>
<div class="im"><br>
<br>
<br>
&gt;<br>
&gt; Regards<br>
&gt; Vikas<br>
&gt;<br>
&gt; On Sun, Jul 11, 2010 at 1:04 PM, Siddharth Prakash Singh<br>
&gt; &lt;<a href="mailto:spsneo@gmail.com">spsneo@gmail.com</a>&gt;wrote:<br>
&gt;<br>
&gt;&gt; Hi Christoph,<br>
&gt;&gt;<br>
&gt;&gt; Twitter uses the format like GET user/id.json or GET user/id.xml<br>
&gt;&gt;<br>
&gt;&gt; Siddharth<br>
&gt;&gt;<br>
&gt;&gt; On Sun, Jul 11, 2010 at 12:54 PM, Christoph Baudson<br>
&gt;&gt; &lt;<a href="mailto:christoph@baudson.de">christoph@baudson.de</a>&gt; wrote:<br>
</div><div><div></div><div class="h5">&gt; Hi Vikas,<br>
&gt;<br>
&gt; Vikas Banjara wrote:<br>
&gt;&gt;&gt;&gt;&gt; Hi all,<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; I want a discussion on ways of handling REST API Request. Rest request<br>
&gt;&gt;&gt; URL<br>
&gt;&gt;&gt;&gt;&gt; will be like -<br>
&gt;&gt;&gt;&gt;&gt; GET api/user/id.json or Get api/user/id.xml<br>
&gt;&gt;&gt;&gt;&gt; Now all the requests are handled by one page say api/index.php. So how<br>
&gt;&gt;&gt; are<br>
&gt;&gt;&gt;&gt;&gt; we going to redirect all such request to this index.php.<br>
&gt;&gt;&gt;&gt;&gt; One solution could be Apache rewrite.<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; Is it a good solution? Is it a standard solution? Any other better<br>
&gt;&gt;&gt; solution?<br>
&gt; I had studied a book [1] on RESTful Web Services with PHP last year. The<br>
&gt; authors used the following style of representing resources<br>
&gt;<br>
&gt; api/user.php/&lt;id&gt;/json<br>
&gt;<br>
&gt; Not sure if this is the standard way, but I think it&#39;s easier to start<br>
&gt; without rewrite rules (more people will join and test).<br>
&gt;<br>
&gt; Read more about it at my blog [2].<br>
&gt;<br>
&gt; Comments?<br>
&gt;<br>
&gt; Christoph<br>
&gt;<br>
&gt; [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>
&gt; [2]<br>
&gt;<br>
&gt;&gt;&gt; <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>

&gt;<br>
&gt;&gt;&gt;&gt;&gt; Thanks<br>
&gt;&gt;&gt;&gt;&gt; Vikas<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; ------------------------------------------------------------------------<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt; Mapbender_dev mailing list<br>
&gt;&gt;&gt;&gt;&gt; <a href="mailto:Mapbender_dev@lists.osgeo.org">Mapbender_dev@lists.osgeo.org</a><br>
&gt;&gt;&gt;&gt;&gt; <a href="http://lists.osgeo.org/mailman/listinfo/mapbender_dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapbender_dev</a><br>
</div></div><div class="im">_______________________________________________<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>
&gt;&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; --<br>
&gt;&gt; Siddharth Prakash Singh<br>
&gt;&gt; <a href="http://www.spsneo.com" target="_blank">http://www.spsneo.com</a><br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Mapbender_dev mailing list<br>
&gt;&gt; <a href="mailto:Mapbender_dev@lists.osgeo.org">Mapbender_dev@lists.osgeo.org</a><br>
&gt;&gt; <a href="http://lists.osgeo.org/mailman/listinfo/mapbender_dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapbender_dev</a><br>
&gt;&gt;<br>
<br>
</div><div class="im">&gt; ------------------------------------------------------------------------<br>
<br>
&gt; _______________________________________________<br>
&gt; Mapbender_dev mailing list<br>
&gt; <a href="mailto:Mapbender_dev@lists.osgeo.org">Mapbender_dev@lists.osgeo.org</a><br>
&gt; <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>
</div>iEYEARECAAYFAkw5hpMACgkQGtMIfbycMX5daACgzrUR02TkzzWZIt6L3WDJb190<br>
FWwAn2IAhmNrKSwDAJyet2AUcapC7o8h<br>
=r/bB<br>
<div><div></div><div class="h5">-----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>
</div></div></blockquote></div><br>