summaryrefslogtreecommitdiffstats
path: root/archives/extend/2014-August/000448.html
blob: 8197f2209634f30ef013aa44396923505f61b67b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!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>