<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Creating a PHP REST API Using the Zend Framework</title>
	<atom:link href="http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/</link>
	<description>Trials and Tribulations of a Software Developer</description>
	<lastBuildDate>Tue, 07 Sep 2010 14:29:17 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Andreas Kompanez</title>
		<link>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/comment-page-1/#comment-240</link>
		<dc:creator>Andreas Kompanez</dc:creator>
		<pubDate>Wed, 17 Feb 2010 08:50:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=219#comment-240</guid>
		<description>&lt;blockquote cite=&quot;#commentbody-229&quot;&gt;
&lt;strong&gt;&lt;a href=&quot;#comment-229&quot; rel=&quot;nofollow&quot;&gt;dangtruog&lt;/a&gt; :&lt;/strong&gt;
          Hi Chris Danielson,
I’m newbie ZF, I have a question.
Why we have theses code below:
[code]
$bootstrap = $this-&gt;getInvokeArg(&#039;bootstrap&#039;);
$options = $bootstrap-&gt;getOption(&#039;resources&#039;);
[/code]
Where is used it on your code?
         &lt;/blockquote&gt;

Nowhere actually, but shows nicely how to access your application.ini parameters.</description>
		<content:encoded><![CDATA[<blockquote cite="#commentbody-229"><p>
<strong><a href="#comment-229" rel="nofollow">dangtruog</a> :</strong><br />
          Hi Chris Danielson,<br />
I’m newbie ZF, I have a question.<br />
Why we have theses code below:<br />
[code]<br />
$bootstrap = $this-&gt;getInvokeArg('bootstrap');<br />
$options = $bootstrap-&gt;getOption('resources');<br />
[/code]<br />
Where is used it on your code?
         </p></blockquote>
<p>Nowhere actually, but shows nicely how to access your application.ini parameters.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: dangtruog</title>
		<link>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/comment-page-1/#comment-229</link>
		<dc:creator>dangtruog</dc:creator>
		<pubDate>Tue, 02 Feb 2010 02:50:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=219#comment-229</guid>
		<description>Hi Chris Danielson,
I&#039;m newbie ZF, I have a question.
Why we have theses code below:
[code]
$bootstrap = $this-&gt;getInvokeArg(&#039;bootstrap&#039;);
$options = $bootstrap-&gt;getOption(&#039;resources&#039;);
[/code]
Where is used it on your code?</description>
		<content:encoded><![CDATA[<p>Hi Chris Danielson,<br />
I&#8217;m newbie ZF, I have a question.<br />
Why we have theses code below:<br />
[code]<br />
$bootstrap = $this-&gt;getInvokeArg('bootstrap');<br />
$options = $bootstrap-&gt;getOption('resources');<br />
[/code]<br />
Where is used it on your code?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Danielson</title>
		<link>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/comment-page-1/#comment-157</link>
		<dc:creator>Chris Danielson</dc:creator>
		<pubDate>Fri, 04 Dec 2009 15:58:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=219#comment-157</guid>
		<description>My code is available for you to freely use and distribute.  No limitations, just user beware, know what you are implementing and don&#039;t blame me if you blow up your stack.  :)

Regards,
Chris</description>
		<content:encoded><![CDATA[<p>My code is available for you to freely use and distribute.  No limitations, just user beware, know what you are implementing and don&#8217;t blame me if you blow up your stack.  <img src='http://www.chrisdanielson.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Regards,<br />
Chris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier Berger</title>
		<link>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/comment-page-1/#comment-156</link>
		<dc:creator>Olivier Berger</dc:creator>
		<pubDate>Fri, 04 Dec 2009 15:51:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=219#comment-156</guid>
		<description>What is the copyright / license on your code ?</description>
		<content:encoded><![CDATA[<p>What is the copyright / license on your code ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Danielson</title>
		<link>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/comment-page-1/#comment-126</link>
		<dc:creator>Chris Danielson</dc:creator>
		<pubDate>Wed, 28 Oct 2009 20:04:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=219#comment-126</guid>
		<description>Excellent.  That makes total sense in the Zend paradigm.  Thanks for sharing!
Regards,
Chris</description>
		<content:encoded><![CDATA[<p>Excellent.  That makes total sense in the Zend paradigm.  Thanks for sharing!<br />
Regards,<br />
Chris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Björn</title>
		<link>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/comment-page-1/#comment-125</link>
		<dc:creator>Björn</dc:creator>
		<pubDate>Wed, 28 Oct 2009 19:57:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=219#comment-125</guid>
		<description>Well, it&#039;s quite easy. According to the documentation the URLs that the REST routes matches to are only http:/yourSite/version and http:/yourSite/version/:id and how the rest controller is invoked depends on the request method (GET, POST, PUT etc.). To get the ContextSwitch functioning you have to append the parameter &#039;format&#039; as a query string like http:/yourSite/version?format=xml or http:/yourSite/version/:id?format=json. That&#039;s it. I also added a frontcontroller plugin that detects if the request is a XmlHttpRequest (for ajax stuff) and inserts the format parameter into the request object.
Best regards,
Björn</description>
		<content:encoded><![CDATA[<p>Well, it&#8217;s quite easy. According to the documentation the URLs that the REST routes matches to are only http:/yourSite/version and http:/yourSite/version/:id and how the rest controller is invoked depends on the request method (GET, POST, PUT etc.). To get the ContextSwitch functioning you have to append the parameter &#8216;format&#8217; as a query string like http:/yourSite/version?format=xml or http:/yourSite/version/:id?format=json. That&#8217;s it. I also added a frontcontroller plugin that detects if the request is a XmlHttpRequest (for ajax stuff) and inserts the format parameter into the request object.<br />
Best regards,<br />
Björn</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Danielson</title>
		<link>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/comment-page-1/#comment-124</link>
		<dc:creator>Chris Danielson</dc:creator>
		<pubDate>Wed, 28 Oct 2009 17:55:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=219#comment-124</guid>
		<description>&lt;blockquote cite=&quot;#commentbody-123&quot;&gt;
&lt;strong&gt;&lt;a href=&quot;#comment-123&quot; rel=&quot;nofollow&quot;&gt;Björn&lt;/a&gt; :&lt;/strong&gt;
But never mind, I found out what I did wrong in my app and it works now (simply wrong usage of the contextSwitch ie.).&lt;br&gt;
Best regards,&lt;br&gt;
Björn&lt;/p&gt;
         &lt;/blockquote&gt;
No problem.   Thanks for commenting here on this information.  What did you do to get the ContextSwitch functioning predictably?  Is there a particular call that I wasn&#039;t making? 
Kind Regards,
Chris</description>
		<content:encoded><![CDATA[<blockquote cite="#commentbody-123"><p>
<strong><a href="#comment-123" rel="nofollow">Björn</a> :</strong><br />
But never mind, I found out what I did wrong in my app and it works now (simply wrong usage of the contextSwitch ie.).<br />
Best regards,<br />
Björn
         </p></blockquote>
<p>No problem.   Thanks for commenting here on this information.  What did you do to get the ContextSwitch functioning predictably?  Is there a particular call that I wasn&#8217;t making?<br />
Kind Regards,<br />
Chris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Björn</title>
		<link>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/comment-page-1/#comment-123</link>
		<dc:creator>Björn</dc:creator>
		<pubDate>Wed, 28 Oct 2009 17:52:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=219#comment-123</guid>
		<description>Hi Chris,
thanks for your reply. I think it makes perfect sense that appending &#039;get&#039; or &#039;post&#039; to the URL works, because it would also match the default route and not the REST route. The &#039;index&#039; action then is called of course because of the _forward statements. 
But never mind, I found out what I did wrong in my app and it works now (simply wrong usage of the contextSwitch ie.).
Best regards,
Björn</description>
		<content:encoded><![CDATA[<p>Hi Chris,<br />
thanks for your reply. I think it makes perfect sense that appending &#8216;get&#8217; or &#8216;post&#8217; to the URL works, because it would also match the default route and not the REST route. The &#8216;index&#8217; action then is called of course because of the _forward statements.<br />
But never mind, I found out what I did wrong in my app and it works now (simply wrong usage of the contextSwitch ie.).<br />
Best regards,<br />
Björn</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Danielson</title>
		<link>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/comment-page-1/#comment-122</link>
		<dc:creator>Chris Danielson</dc:creator>
		<pubDate>Wed, 28 Oct 2009 17:08:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=219#comment-122</guid>
		<description>Björn,
You may be correct that the REST route is bypassed.  I haven&#039;t looked at an exact stack trace, nor have I crawled the code base to see if I&#039;m not getting the ContextSwitch put into place.  What I have discovered in the short term studying I did with Zend REST Framework was that the URL issue you are running across regarding the &quot;index&quot; action always getting called was fixed by doing the following.
http:/yourSite/version/get
or
http:/yourSite/version/post/:id
or
http:/yourSite/version/put

That seems to force the engine into a particular conditional allowing for the &quot;other&quot; actions to be called.  
Regards,
Chris</description>
		<content:encoded><![CDATA[<p>Björn,<br />
You may be correct that the REST route is bypassed.  I haven&#8217;t looked at an exact stack trace, nor have I crawled the code base to see if I&#8217;m not getting the ContextSwitch put into place.  What I have discovered in the short term studying I did with Zend REST Framework was that the URL issue you are running across regarding the &#8220;index&#8221; action always getting called was fixed by doing the following.<br />
http:/yourSite/version/get<br />
or<br />
http:/yourSite/version/post/:id<br />
or<br />
http:/yourSite/version/put</p>
<p>That seems to force the engine into a particular conditional allowing for the &#8220;other&#8221; actions to be called.<br />
Regards,<br />
Chris</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Björn</title>
		<link>http://www.chrisdanielson.com/2009/09/02/creating-a-php-rest-api-using-the-zend-framework/comment-page-1/#comment-121</link>
		<dc:creator>Björn</dc:creator>
		<pubDate>Wed, 28 Oct 2009 16:48:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.chrisdanielson.com/?p=219#comment-121</guid>
		<description>Hi,
please correct me if I&#039;m wrong but AFAIK Zend_Rest_Route will not match URLs other than http://yourSite/version and http://yourSite/version/:id. In your example all requests that contain the parameters &quot;format&quot; or &quot;id&quot; will bypass the REST route and be routed to VersionController and its indexAction by the default route.  I am currently trying to create a REST service in ZF that implements the context switch with no luck and found your example.
Best regards,
Björn</description>
		<content:encoded><![CDATA[<p>Hi,<br />
please correct me if I&#8217;m wrong but AFAIK Zend_Rest_Route will not match URLs other than <a href="http://yourSite/version" rel="nofollow">http://yourSite/version</a> and <a href="http://yourSite/version/:id" rel="nofollow">http://yourSite/version/:id</a>. In your example all requests that contain the parameters &#8220;format&#8221; or &#8220;id&#8221; will bypass the REST route and be routed to VersionController and its indexAction by the default route.  I am currently trying to create a REST service in ZF that implements the context switch with no luck and found your example.<br />
Best regards,<br />
Björn</p>
]]></content:encoded>
	</item>
</channel>
</rss>
