diff options
Diffstat (limited to '_build/static/archives/extend/2014-August/000449.html')
-rw-r--r-- | _build/static/archives/extend/2014-August/000449.html | 167 |
1 files changed, 167 insertions, 0 deletions
diff --git a/_build/static/archives/extend/2014-August/000449.html b/_build/static/archives/extend/2014-August/000449.html new file mode 100644 index 00000000..059b0783 --- /dev/null +++ b/_build/static/archives/extend/2014-August/000449.html @@ -0,0 +1,167 @@ +<!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=%3C53FDACFD.7020204%40ninenines.eu%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="000448.html"> + <LINK REL="Next" HREF="000450.html"> + </HEAD> + <BODY BGCOLOR="#ffffff"> + <H1>[99s-extend] I need your feedback about this cowboy_rest handler.</H1> + <B>Loïc Hoguin</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=%3C53FDACFD.7020204%40ninenines.eu%3E" + TITLE="[99s-extend] I need your feedback about this cowboy_rest handler.">essen at ninenines.eu + </A><BR> + <I>Wed Aug 27 12:03:41 CEST 2014</I> + <P><UL> + <LI>Previous message: <A HREF="000448.html">[99s-extend] I need your feedback about this cowboy_rest handler. +</A></li> + <LI>Next message: <A HREF="000450.html">[99s-extend] I need your feedback about this cowboy_rest handler. +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#449">[ date ]</a> + <a href="thread.html#449">[ thread ]</a> + <a href="subject.html#449">[ subject ]</a> + <a href="author.html#449">[ author ]</a> + </LI> + </UL> + <HR> +<!--beginarticle--> +<PRE>Hey, + +On 08/27/2014 12:29 PM, Stéphane Wirtel wrote: +><i> Hi all, +</I>><i> +</I>><i> This night, I wrote an example because I wanted to show you my work. +</I>><i> +</I>><i> I have one handler for the concept of collections (in this case, tasks). +</I>><i> +</I>><i> In this handler, I want these following methods: +</I>><i> +</I>><i> POST /:collection +</I>><i> GET /:collection +</I>><i> DELETE /:collection +</I>><i> PUT /:collection +</I>><i> HEAD /:collection +</I>><i> +</I>><i> :collection is a string, example: /tasks1 +</I>><i> +</I>><i> HEAD /:collection (/tasks1) +</I>><i> StatusCode: +</I>><i> * 200 ok +</I>><i> * 404 not found +</I>><i> +</I>><i> GET /:collection (/tasks1) +</I>><i> Gets information about the collection +</I>><i> StatusCode: +</I>><i> * 200 ok +</I>><i> * 404 not found +</I>><i> +</I>><i> PUT /:collection (/tasks1) +</I>><i> Create a new collection of tasks +</I>><i> Status_Code: +</I>><i> * 201 created +</I>><i> Response: an object, in msgpack or json and I need to had a +</I>><i> location header +</I>><i> * 412 precondition failed, the collection name already exists +</I>><i> Response: an object, in msgpack or json with the error (already +</I>><i> exists) +</I>><i> +</I>><i> POST /:collection (/tasks1) +</I>><i> Add a new item in the collection, a new task +</I>><i> StatusCode: +</I>><i> * 201 created +</I>><i> * 202 accepted +</I>><i> * 404 not found (error in the collection name) +</I>><i> Response: need to add a location header and return an object in msgpack +</I>><i> or json. +</I>><i> +</I>><i> DELETE /:collection (/tasks1) +</I>><i> Delete all the tasks +</I>><i> Status_Code: +</I>><i> * 200 ok. +</I>><i> * 404 not found +</I>><i> In the case of 200, we need to return an object in msgpack or json. +</I>><i> +</I>><i> +</I>><i> I provided a code and If you can help me, because I think cowboy_rest is +</I>><i> a good solution, but I also think I will have some problems with my +</I>><i> service. +</I>><i> +</I>><i> Examples: +</I>><i> * delete_completed, I need to write the serialisation in the +</I>><i> delete_completed function and not with the help of the defined callbacks +</I>><i> of content_types_provided. +</I> +What's the problem? The callbacks you set in content_types_provided are +there to provide the *resource*. If you set a body in response to the +DELETE method you are not sending the resource but information about the +result of the operation. + +><i> * for PUT, I need to return a location header, should I add it in the +</I>><i> is_conflict +</I>><i> function? +</I> +I would say in the callback you set in content_types_accepted. But... + +><i> * for PUT, how I have a 201? I have read the rest_flowchart and I need +</I>><i> to specify the location header ok, but where? in the is_conflict function? +</I> +Why do you need a 201? If you PUT a collection to /:collection then this +is already the location of the collection. I am not sure what you are +trying to do there exactly? + +><i> So, do you have time to help me, because with this example, I can +</I>><i> propose it to the cowboy repository. +</I>><i> <A HREF="https://github.com/matrixise/demo_rest/blob/master/src/collection_handler.erl">https://github.com/matrixise/demo_rest/blob/master/src/collection_handler.erl</A> +</I>><i> +</I>><i> +</I>><i> You can propose your PR, comments or remarks, but I would like to use +</I>><i> cowboy_rest. +</I>><i> +</I>><i> Regards, +</I>><i> +</I>><i> Stephane +</I>><i> +</I>><i> -- +</I>><i> Stéphane Wirtel - <A HREF="http://wirtel.be">http://wirtel.be</A> - @matrixise +</I>><i> _______________________________________________ +</I>><i> Extend mailing list +</I>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">Extend at lists.ninenines.eu</A> +</I>><i> <A HREF="https://lists.ninenines.eu/listinfo/extend">https://lists.ninenines.eu/listinfo/extend</A> +</I> +-- +Loïc Hoguin +<A HREF="http://ninenines.eu">http://ninenines.eu</A> +</PRE> + + +<!--endarticle--> + <HR> + <P><UL> + <!--threads--> + <LI>Previous message: <A HREF="000448.html">[99s-extend] I need your feedback about this cowboy_rest handler. +</A></li> + <LI>Next message: <A HREF="000450.html">[99s-extend] I need your feedback about this cowboy_rest handler. +</A></li> + <LI> <B>Messages sorted by:</B> + <a href="date.html#449">[ date ]</a> + <a href="thread.html#449">[ thread ]</a> + <a href="subject.html#449">[ subject ]</a> + <a href="author.html#449">[ author ]</a> + </LI> + </UL> + +<hr> +<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend +mailing list</a><br> +</body></html> |