summaryrefslogblamecommitdiffstats
path: root/archives/extend/2014-August/000448.html
blob: 8197f2209634f30ef013aa44396923505f61b67b (plain) (tree)













































































































































                                                                                                                                                                                                                                       
<!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%20handler.&In-Reply-To=%3CC5A27633-46B8-47E3-816C-BFB44584E6CC%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="000447.html">
   <LINK REL="Next"  HREF="000449.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%20handler.&In-Reply-To=%3CC5A27633-46B8-47E3-816C-BFB44584E6CC%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 11:29:46 CEST 2014</I>
    <P><UL>
        <LI>Previous message: <A HREF="000447.html">[99s-extend] cowboy_rest and delete_completed and response
</A></li>
        <LI>Next message: <A HREF="000449.html">[99s-extend] I need your feedback about this cowboy_rest	handler.
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#448">[ date ]</a>
              <a href="thread.html#448">[ thread ]</a>
              <a href="subject.html#448">[ subject ]</a>
              <a href="author.html#448">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>Hi all,

This night, I wrote an example because I wanted to show you my work.

I have one handler for the concept of collections (in this case, tasks).

In this handler, I want these following methods:

POST /:collection
GET /:collection
DELETE /:collection
PUT /:collection
HEAD /:collection

:<i>collection is a string, example: /tasks1
</I>
HEAD /:collection (/tasks1)
StatusCode:
	* 200 ok
	* 404 not found

GET /:collection (/tasks1)
Gets information about the collection
StatusCode:
	* 200 ok
	* 404 not found

PUT /:collection (/tasks1)
Create a new collection of tasks
Status_Code:
	* 201 created
	Response: an object, in msgpack or json and I need to had a location 
header
	* 412 precondition failed, the collection name already exists
	Response: an object, in msgpack or json with the error (already exists)

POST /:collection (/tasks1)
Add a new item in the collection, a new task
StatusCode:
	* 201 created
	* 202 accepted
	* 404 not found (error in the collection name)
Response: need to add a location header and return an object in msgpack 
or json.

DELETE /:collection (/tasks1)
Delete all the tasks
Status_Code:
	* 200 ok.
	* 404 not found
In the case of 200, we need to return an object in msgpack or json.


I provided a code and If you can help me, because I think cowboy_rest is 
a good solution, but I also think I will have some problems with my 
service.

Examples:
* delete_completed, I need to write the serialisation in the 
delete_completed function and not with the help of the defined callbacks 
of content_types_provided.
* for PUT, I need to return a location header, should I add it in the 
is_conflict
function?
* for PUT, how I have a 201? I have read the rest_flowchart and I need 
to specify the location header ok, but where? in the is_conflict 
function?

So, do you have time to help me, because with this example, I can 
propose it to the cowboy repository.
<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>

You can propose your PR, comments or remarks, but I would like to use 
cowboy_rest.

Regards,

Stephane

--
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="000447.html">[99s-extend] cowboy_rest and delete_completed and response
</A></li>
	<LI>Next message: <A HREF="000449.html">[99s-extend] I need your feedback about this cowboy_rest	handler.
</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#448">[ date ]</a>
              <a href="thread.html#448">[ thread ]</a>
              <a href="subject.html#448">[ subject ]</a>
              <a href="author.html#448">[ author ]</a>
         </LI>
       </UL>

<hr>
<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend
mailing list</a><br>
</body></html>