summaryrefslogtreecommitdiffstats
path: root/_build/static/archives/extend/2014-August/000450.html
diff options
context:
space:
mode:
Diffstat (limited to '_build/static/archives/extend/2014-August/000450.html')
-rw-r--r--_build/static/archives/extend/2014-August/000450.html168
1 files changed, 168 insertions, 0 deletions
diff --git a/_build/static/archives/extend/2014-August/000450.html b/_build/static/archives/extend/2014-August/000450.html
new file mode 100644
index 00000000..d1b5de08
--- /dev/null
+++ b/_build/static/archives/extend/2014-August/000450.html
@@ -0,0 +1,168 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+ <HEAD>
+ <TITLE> [99s-extend] I need your feedback about this cowboy_rest handler.
+ </TITLE>
+ <LINK REL="Index" HREF="index.html" >
+ <LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20I%20need%20your%20feedback%20about%20this%20cowboy_rest%0A%09handler.&In-Reply-To=%3CC563DB6C-5C79-4E13-929B-25C64B13DCD0%40wirtel.be%3E">
+ <META NAME="robots" CONTENT="index,nofollow">
+ <style type="text/css">
+ pre {
+ white-space: pre-wrap; /* css-2.1, curent FF, Opera, Safari */
+ }
+ </style>
+ <META http-equiv="Content-Type" content="text/html; charset=us-ascii">
+ <LINK REL="Previous" HREF="000449.html">
+ <LINK REL="Next" HREF="000451.html">
+ </HEAD>
+ <BODY BGCOLOR="#ffffff">
+ <H1>[99s-extend] I need your feedback about this cowboy_rest handler.</H1>
+ <B>St&#233;phane Wirtel</B>
+ <A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20I%20need%20your%20feedback%20about%20this%20cowboy_rest%0A%09handler.&In-Reply-To=%3CC563DB6C-5C79-4E13-929B-25C64B13DCD0%40wirtel.be%3E"
+ TITLE="[99s-extend] I need your feedback about this cowboy_rest handler.">stephane at wirtel.be
+ </A><BR>
+ <I>Wed Aug 27 12:35:33 CEST 2014</I>
+ <P><UL>
+ <LI>Previous message: <A HREF="000449.html">[99s-extend] I need your feedback about this cowboy_rest handler.
+</A></li>
+ <LI>Next message: <A HREF="000451.html">[99s-extend] I need your feedback about this cowboy_rest handler.
+</A></li>
+ <LI> <B>Messages sorted by:</B>
+ <a href="date.html#450">[ date ]</a>
+ <a href="thread.html#450">[ thread ]</a>
+ <a href="subject.html#450">[ subject ]</a>
+ <a href="author.html#450">[ author ]</a>
+ </LI>
+ </UL>
+ <HR>
+<!--beginarticle-->
+<PRE>On 27 Aug 2014, at 12:03, Lo&#239;c Hoguin wrote:
+
+&gt;<i> Hey,
+</I>&gt;<i>
+</I>&gt;<i> On 08/27/2014 12:29 PM, St&#233;phane Wirtel wrote:
+</I>&gt;&gt;<i> Hi all,
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> This night, I wrote an example because I wanted to show you my work.
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> I have one handler for the concept of collections (in this case,
+</I>&gt;&gt;<i> tasks).
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> In this handler, I want these following methods:
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> POST /:collection
+</I>&gt;&gt;<i> GET /:collection
+</I>&gt;&gt;<i> DELETE /:collection
+</I>&gt;&gt;<i> PUT /:collection
+</I>&gt;&gt;<i> HEAD /:collection
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> :collection is a string, example: /tasks1
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> HEAD /:collection (/tasks1)
+</I>&gt;&gt;<i> StatusCode:
+</I>&gt;&gt;<i> * 200 ok
+</I>&gt;&gt;<i> * 404 not found
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> GET /:collection (/tasks1)
+</I>&gt;&gt;<i> Gets information about the collection
+</I>&gt;&gt;<i> StatusCode:
+</I>&gt;&gt;<i> * 200 ok
+</I>&gt;&gt;<i> * 404 not found
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> PUT /:collection (/tasks1)
+</I>&gt;&gt;<i> Create a new collection of tasks
+</I>&gt;&gt;<i> Status_Code:
+</I>&gt;&gt;<i> * 201 created
+</I>&gt;&gt;<i> Response: an object, in msgpack or json and I need to had a
+</I>&gt;&gt;<i> location header
+</I>&gt;&gt;<i> * 412 precondition failed, the collection name already exists
+</I>&gt;&gt;<i> Response: an object, in msgpack or json with the error (already
+</I>&gt;&gt;<i> exists)
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> POST /:collection (/tasks1)
+</I>&gt;&gt;<i> Add a new item in the collection, a new task
+</I>&gt;&gt;<i> StatusCode:
+</I>&gt;&gt;<i> * 201 created
+</I>&gt;&gt;<i> * 202 accepted
+</I>&gt;&gt;<i> * 404 not found (error in the collection name)
+</I>&gt;&gt;<i> Response: need to add a location header and return an object in
+</I>&gt;&gt;<i> msgpack
+</I>&gt;&gt;<i> or json.
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> DELETE /:collection (/tasks1)
+</I>&gt;&gt;<i> Delete all the tasks
+</I>&gt;&gt;<i> Status_Code:
+</I>&gt;&gt;<i> * 200 ok.
+</I>&gt;&gt;<i> * 404 not found
+</I>&gt;&gt;<i> In the case of 200, we need to return an object in msgpack or json.
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> I provided a code and If you can help me, because I think cowboy_rest
+</I>&gt;&gt;<i> is
+</I>&gt;&gt;<i> a good solution, but I also think I will have some problems with my
+</I>&gt;&gt;<i> service.
+</I>&gt;&gt;<i>
+</I>&gt;&gt;<i> Examples:
+</I>&gt;&gt;<i> * delete_completed, I need to write the serialisation in the
+</I>&gt;&gt;<i> delete_completed function and not with the help of the defined
+</I>&gt;&gt;<i> callbacks
+</I>&gt;&gt;<i> of content_types_provided.
+</I>&gt;<i>
+</I>&gt;<i> What's the problem? The callbacks you set in content_types_provided
+</I>&gt;<i> are there to provide the *resource*. If you set a body in response to
+</I>&gt;<i> the DELETE method you are not sending the resource but information
+</I>&gt;<i> about the result of the operation.
+</I>Ok, in this case, I understand. thanks
+&gt;<i>
+</I>&gt;&gt;<i> * for PUT, I need to return a location header, should I add it in the
+</I>&gt;&gt;<i> is_conflict
+</I>&gt;&gt;<i> function?
+</I>&gt;<i>
+</I>&gt;<i> I would say in the callback you set in content_types_accepted. But...
+</I>Works fine in the is_conflict function.
+&gt;<i>
+</I>&gt;&gt;<i> * for PUT, how I have a 201? I have read the rest_flowchart and I
+</I>&gt;&gt;<i> need
+</I>&gt;&gt;<i> to specify the location header ok, but where? in the is_conflict
+</I>&gt;&gt;<i> function?
+</I>&gt;<i>
+</I>&gt;<i> Why do you need a 201? If you PUT a collection to /:collection then
+</I>&gt;<i> this is already the location of the collection. I am not sure what you
+</I>&gt;<i> are trying to do there exactly?
+</I>In this case, the PUT method is used for the creation of the resource
+and not for the update. This is the reason of the 201 status code.
+
+In the rest_flowchart graph for the PUT/POST methods, what is the node
+&quot;new resource&quot; ? Is it just the {true, Req, State} from the callback
+defined in the content_types_accepted?
+
+PS: I retested and now, I have my 201 with PUT, just resource_exists has
+to return false and not true ;-)
+
+Thanks
+
+--
+St&#233;phane Wirtel - <A HREF="http://wirtel.be">http://wirtel.be</A> - @matrixise
+</PRE>
+
+
+<!--endarticle-->
+ <HR>
+ <P><UL>
+ <!--threads-->
+ <LI>Previous message: <A HREF="000449.html">[99s-extend] I need your feedback about this cowboy_rest handler.
+</A></li>
+ <LI>Next message: <A HREF="000451.html">[99s-extend] I need your feedback about this cowboy_rest handler.
+</A></li>
+ <LI> <B>Messages sorted by:</B>
+ <a href="date.html#450">[ date ]</a>
+ <a href="thread.html#450">[ thread ]</a>
+ <a href="subject.html#450">[ subject ]</a>
+ <a href="author.html#450">[ author ]</a>
+ </LI>
+ </UL>
+
+<hr>
+<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend
+mailing list</a><br>
+</body></html>