<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE> [99s-extend] How to use the PUT verb with Cowboy_Rest ?
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20How%20to%20use%20the%20PUT%20verb%20with%20Cowboy_Rest%20%3F&In-Reply-To=%3C864BDA07-F0F6-43A3-8D6C-12056DFE6C5E%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="000441.html">
<LINK REL="Next" HREF="000443.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[99s-extend] How to use the PUT verb with Cowboy_Rest ?</H1>
<B>Stephane Wirtel</B>
<A HREF="mailto:extend%40lists.ninenines.eu?Subject=Re%3A%20%5B99s-extend%5D%20How%20to%20use%20the%20PUT%20verb%20with%20Cowboy_Rest%20%3F&In-Reply-To=%3C864BDA07-F0F6-43A3-8D6C-12056DFE6C5E%40wirtel.be%3E"
TITLE="[99s-extend] How to use the PUT verb with Cowboy_Rest ?">stephane at wirtel.be
</A><BR>
<I>Sun Aug 24 02:52:58 CEST 2014</I>
<P><UL>
<LI>Previous message: <A HREF="000441.html">[99s-extend] How to use the PUT verb with Cowboy_Rest ?
</A></li>
<LI>Next message: <A HREF="000443.html">[99s-extend] Full example of cowboy_rest?
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#442">[ date ]</a>
<a href="thread.html#442">[ thread ]</a>
<a href="subject.html#442">[ subject ]</a>
<a href="author.html#442">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>Ok I will try asap, thanks
><i> On 24 août 2014, at 02:25 AM, Eduardo Gurgel <<A HREF="https://lists.ninenines.eu/listinfo/extend">edgurgel at gmail.com</A>> wrote:
</I>><i>
</I>><i> I think you can always halt the processing and do the reply by yourself:
</I>><i>
</I>><i> {ok, Req2} = cowboy_req:reply(412, Req),
</I>><i> {halt, Req2, State}.
</I>><i>
</I>><i>
</I>>><i> On Sun, Aug 24, 2014 at 12:22 PM, Stéphane Wirtel <<A HREF="https://lists.ninenines.eu/listinfo/extend">stephane at wirtel.be</A>> wrote:
</I>>><i> resource_exists is used by POST
</I>>><i> is_conflict is used by PUT (from the code)
</I>>><i> but in the case where my database already exists, I need to return 412 and not 409.
</I>>><i>
</I>>><i> and I know I don't respect the default value returned by Cowboy_rest.
</I>>><i>
</I>>><i>
</I>>><i> On 24 Aug 2014, at 2:16, Daniel Goertzen wrote:
</I>>><i>
</I>>>><i> You should implement the resource_exists() callback; this will let the rest
</I>>>><i> module pick a 200 vs 201. If the db name was incorrect, I think you are
</I>>>><i> just supposed to return false from the put callback. I can't remember the
</I>>>><i> http code for that case.
</I>>>><i>
</I>>>><i> Regards,
</I>>>><i> Dan.
</I>>>><i>
</I>>>><i>
</I>>>><i> On Sat, Aug 23, 2014 at 6:58 PM, Stéphane Wirtel <<A HREF="https://lists.ninenines.eu/listinfo/extend">stephane at wirtel.be</A>> wrote:
</I>>>><i>
</I>>>>><i> Hi all,
</I>>>>><i>
</I>>>>><i> 1. I would like to use the cowboy_rest protocol with cowboy 1.0 but I have
</I>>>>><i> a small crash.
</I>>>>><i>
</I>>>>><i> Here is my code:
</I>>>>><i>
</I>>>>><i> <A HREF="https://www.friendpaste.com/7O3X4fG4u31gBg9MgW5xg4">https://www.friendpaste.com/7O3X4fG4u31gBg9MgW5xg4</A>
</I>>>>><i>
</I>>>>><i> Could you tell me if I correctly use cowboy_rest for the PUT verb? I have
</I>>>>><i> seen is_conflict/2, but I don't know how to use it.
</I>>>>><i>
</I>>>>><i> 2. I would like to change the response code, but I get the error. Is it
</I>>>>><i> possible?
</I>>>>><i>
</I>>>>><i> Thank you.
</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>>><i>
</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>><i>
</I>><i>
</I>><i>
</I>><i> --
</I>><i> Eduardo
</I>-------------- next part --------------
An HTML attachment was scrubbed...
URL: <<A HREF="http://lists.ninenines.eu/archives/extend/attachments/20140824/f35e1e51/attachment.html">http://lists.ninenines.eu/archives/extend/attachments/20140824/f35e1e51/attachment.html</A>>
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="000441.html">[99s-extend] How to use the PUT verb with Cowboy_Rest ?
</A></li>
<LI>Next message: <A HREF="000443.html">[99s-extend] Full example of cowboy_rest?
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#442">[ date ]</a>
<a href="thread.html#442">[ thread ]</a>
<a href="subject.html#442">[ subject ]</a>
<a href="author.html#442">[ author ]</a>
</LI>
</UL>
<hr>
<a href="https://lists.ninenines.eu/listinfo/extend">More information about the Extend
mailing list</a><br>
</body></html>