<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Webmachine POST Example</title>
	<atom:link href="http://blog.beerriot.com/2009/05/29/webmachine-post-example/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.beerriot.com/2009/05/29/webmachine-post-example/</link>
	<description>The making of BeerRiot and other thoughts.</description>
	<lastBuildDate>Wed, 28 Oct 2009 04:17:24 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: lou</title>
		<link>http://blog.beerriot.com/2009/05/29/webmachine-post-example/#comment-1605</link>
		<dc:creator>lou</dc:creator>
		<pubDate>Wed, 26 Aug 2009 01:57:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.beerriot.com/?p=179#comment-1605</guid>
		<description>@pablo Thanks, it works now. As you said, we need to add content_types_accepted.

@Bryan Thank you very much. I understand how POST works in webmachine much better now. I also looked at the webmachine decision core itself and saw that redirect() itself actually has a possibility to return a 415 when it calls accept_helper(). This happens when the code cannot see a content_types_accepted() written by the user.</description>
		<content:encoded><![CDATA[<p>@pablo Thanks, it works now. As you said, we need to add content_types_accepted.</p>
<p>@Bryan Thank you very much. I understand how POST works in webmachine much better now. I also looked at the webmachine decision core itself and saw that redirect() itself actually has a possibility to return a 415 when it calls accept_helper(). This happens when the code cannot see a content_types_accepted() written by the user.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan</title>
		<link>http://blog.beerriot.com/2009/05/29/webmachine-post-example/#comment-1604</link>
		<dc:creator>Bryan</dc:creator>
		<pubDate>Tue, 25 Aug 2009 13:02:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.beerriot.com/?p=179#comment-1604</guid>
		<description>Hi, Lou.  I see the trouble - I left content_types_accepted/2 out of the list of functions that demo_fs_resource implements in order to handle POST requests.  Sorry about that, I&#039;ve added it now.  Just to reinforce what Pablo said:

You need two things:
1. a Content-Type header in the POST request
2. a content_types_accepted function in your resource, returning a clause that matches the content-type header in the request

Once you have both of these, instead of ending up at 415, Webmachine will call the function named in content_types_accepted, and in that function you can handle the rest of the POST as if it were a PUT.

Make sense?
</description>
		<content:encoded><![CDATA[<p>Hi, Lou.  I see the trouble &#8211; I left content_types_accepted/2 out of the list of functions that demo_fs_resource implements in order to handle POST requests.  Sorry about that, I&#8217;ve added it now.  Just to reinforce what Pablo said:</p>
<p>You need two things:<br />
1. a Content-Type header in the POST request<br />
2. a content_types_accepted function in your resource, returning a clause that matches the content-type header in the request</p>
<p>Once you have both of these, instead of ending up at 415, Webmachine will call the function named in content_types_accepted, and in that function you can handle the rest of the POST as if it were a PUT.</p>
<p>Make sense?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pablo</title>
		<link>http://blog.beerriot.com/2009/05/29/webmachine-post-example/#comment-1603</link>
		<dc:creator>pablo</dc:creator>
		<pubDate>Tue, 25 Aug 2009 08:34:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.beerriot.com/?p=179#comment-1603</guid>
		<description>When using post_is_create and create_path webmachine treats your request as a PUT with the path you return from create_path. I think you need to indicate the content type you are expecting and the handler in content_types_accepted
because that&#039;s the way PUT works in webmachine.

The method in ReqData will still be POST and the path won&#039;t go through the dispatcher so you&#039;ll get it using wrq:disp_path(ReqData). Maybe it&#039;ll be better to process the url again?</description>
		<content:encoded><![CDATA[<p>When using post_is_create and create_path webmachine treats your request as a PUT with the path you return from create_path. I think you need to indicate the content type you are expecting and the handler in content_types_accepted<br />
because that&#8217;s the way PUT works in webmachine.</p>
<p>The method in ReqData will still be POST and the path won&#8217;t go through the dispatcher so you&#8217;ll get it using wrq:disp_path(ReqData). Maybe it&#8217;ll be better to process the url again?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lou</title>
		<link>http://blog.beerriot.com/2009/05/29/webmachine-post-example/#comment-1602</link>
		<dc:creator>lou</dc:creator>
		<pubDate>Tue, 25 Aug 2009 07:32:43 +0000</pubDate>
		<guid isPermaLink="false">http://blog.beerriot.com/?p=179#comment-1602</guid>
		<description>Hi Bryan,

I&#039;m having a problem processing a POST request. The problem lies when using create_path... it returns a 415 Unsupported Media Type which does not seem possible given the diagram. This problem only occurs when using a create_path in the code. Setting post_is_create to false solves the problem but I need to use create_path so that is not an option.

-Lou</description>
		<content:encoded><![CDATA[<p>Hi Bryan,</p>
<p>I&#8217;m having a problem processing a POST request. The problem lies when using create_path&#8230; it returns a 415 Unsupported Media Type which does not seem possible given the diagram. This problem only occurs when using a create_path in the code. Setting post_is_create to false solves the problem but I need to use create_path so that is not an option.</p>
<p>-Lou</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bryan</title>
		<link>http://blog.beerriot.com/2009/05/29/webmachine-post-example/#comment-1594</link>
		<dc:creator>Bryan</dc:creator>
		<pubDate>Mon, 10 Aug 2009 15:50:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.beerriot.com/?p=179#comment-1594</guid>
		<description>Hey, Pablo.  I think Justin covered most of this on the Webmachine mailing list here: http://bit.ly/Gc2At

But, the short answer is that body-producers (for example, to_json) return bodies because GET is defined as returning a representation, while post-handlers must add bodies if they want because POST is largely open-ended, and certainly not required to return a body.

As for the ReqData confusion, as with many other frameworks, &quot;request&quot; here is used to define the entire processing of the HTTP request, not just the content and headers provided by the client.

The record that represents the ReqData parameter is defined by the wrq module.  It is recommended that you use the functions in the wrq module to modify the structure instead of poking at it directly.  Its methods are also covered on the wiki: http://bitbucket.org/justin/webmachine/wiki/WebmachineReqData</description>
		<content:encoded><![CDATA[<p>Hey, Pablo.  I think Justin covered most of this on the Webmachine mailing list here: <a href="http://bit.ly/Gc2At" rel="nofollow">http://bit.ly/Gc2At</a></p>
<p>But, the short answer is that body-producers (for example, to_json) return bodies because GET is defined as returning a representation, while post-handlers must add bodies if they want because POST is largely open-ended, and certainly not required to return a body.</p>
<p>As for the ReqData confusion, as with many other frameworks, &#8220;request&#8221; here is used to define the entire processing of the HTTP request, not just the content and headers provided by the client.</p>
<p>The record that represents the ReqData parameter is defined by the wrq module.  It is recommended that you use the functions in the wrq module to modify the structure instead of poking at it directly.  Its methods are also covered on the wiki: <a href="http://bitbucket.org/justin/webmachine/wiki/WebmachineReqData" rel="nofollow">http://bitbucket.org/justin/webmachine/wiki/WebmachineReqData</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pablo</title>
		<link>http://blog.beerriot.com/2009/05/29/webmachine-post-example/#comment-1593</link>
		<dc:creator>pablo</dc:creator>
		<pubDate>Mon, 10 Aug 2009 06:05:25 +0000</pubDate>
		<guid isPermaLink="false">http://blog.beerriot.com/?p=179#comment-1593</guid>
		<description>Why when receiving a GET the response is just the first term in the tuple at the end of to_json {json_body(wrq:req_qs(RD)), RD, Ctx}.

and when receiving a POST you have to use append_to_response_body ?

In addition, append_to_response_body(binary(),rd()) -&gt; rd() returns ReqData. Isn&#039;t ReqData misleading considering it is used both for request and response data?
Can I find a definition of this record?

Thanks</description>
		<content:encoded><![CDATA[<p>Why when receiving a GET the response is just the first term in the tuple at the end of to_json {json_body(wrq:req_qs(RD)), RD, Ctx}.</p>
<p>and when receiving a POST you have to use append_to_response_body ?</p>
<p>In addition, append_to_response_body(binary(),rd()) -&gt; rd() returns ReqData. Isn&#8217;t ReqData misleading considering it is used both for request and response data?<br />
Can I find a definition of this record?</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sebastian</title>
		<link>http://blog.beerriot.com/2009/05/29/webmachine-post-example/#comment-1537</link>
		<dc:creator>Sebastian</dc:creator>
		<pubDate>Sat, 30 May 2009 10:11:06 +0000</pubDate>
		<guid isPermaLink="false">http://blog.beerriot.com/?p=179#comment-1537</guid>
		<description>Great stuff!
Thanks!

All the best,
Sebastian</description>
		<content:encoded><![CDATA[<p>Great stuff!<br />
Thanks!</p>
<p>All the best,<br />
Sebastian</p>
]]></content:encoded>
	</item>
</channel>
</rss>
