Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Do I use PUT?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Indu  
View profile  
 More options Sep 13 2012, 10:43 am
From: Indu <indu9...@gmail.com>
Date: Thu, 13 Sep 2012 07:43:31 -0700 (PDT)
Local: Thurs, Sep 13 2012 10:43 am
Subject: Do I use PUT?

Hi all,

      I m working on developing api and I ve read in some article that PUT
shall be used for complete replacement.But while referring to some API
docs,they don't use PUT anymore though they have used the same in their
previous version and it was replaced by POST(/resources/id) or PATCH(for
partial updation)? And I m confused whether to use PUT or I will go with
POST? And curious to know about the difference in using POST and PUT for
updation?

Thanks for looking into this

Thanks & Regards,
Indu


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ian Joyce  
View profile  
 More options Sep 13 2012, 10:54 am
From: Ian Joyce <ian.jo...@gmail.com>
Date: Thu, 13 Sep 2012 09:54:49 -0500
Local: Thurs, Sep 13 2012 10:54 am
Subject: Re: [api-craft] Do I use PUT?
You can read the relevant bits of the spec here:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

But generally speaking PUT is for creating a resource and POST is for
updating a resource.

--Ian


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Enrique Amodeo  
View profile  
 More options Sep 13 2012, 10:56 am
From: Enrique Amodeo <eamodeoru...@gmail.com>
Date: Thu, 13 Sep 2012 16:56:27 +0200
Local: Thurs, Sep 13 2012 10:56 am
Subject: Re: [api-craft] Do I use PUT?
Hi Indu, the answer is a bit tricky. First of all the URI must exist
before the request. Then you have several options:
a) If you want complete replacement of the state use PUT. It has the
big advantage of being idempotent. Do not use this for partial
updates.
b) If you want partial update use PATCH. Ensure to use a mime type
that has appropiate semantics (partial document, diff, ...). It isn't
idempotent, so you should use some mechanism to avoid problems with
duplicated request (if-match, etag). The problem is that it's only a
proposed standard, so most server don't understand it:
http://tools.ietf.org/html/rfc5789
c) The old way for partial updates is using POST instead PATCH. Not
standarized. Usually use the same practices that the ones used with
PATCH.  It is good to add a header: "X-HTTP-Method-Override: PATCH" in
order to more modern server switch to PATCH semantics.

Cheers !


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Indu  
View profile  
 More options Sep 13 2012, 11:08 am
From: Indu <indu9...@gmail.com>
Date: Thu, 13 Sep 2012 08:08:57 -0700 (PDT)
Local: Thurs, Sep 13 2012 11:08 am
Subject: Re: [api-craft] Do I use PUT?

Thanks Joyce and Enrique

          But while I m using PUT for updating I m facing the following
issue:

           1. I m not able to send the parameters in the request body,is
forcing me to send it in the query parameter. I m afraid is it safe to send
the write operation's parameters in query string and also the content
length may exceed the allowed size of the query string if I send a large
data for updation.
            2.And also tomcat is not retrieving the value if in
request.getParameter while using PUT

           So I need to know whether this issue has been faced? And also
why am I getting so?

Thanks and Regards
Indu


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Enrique Amodeo  
View profile  
 More options Sep 13 2012, 11:40 am
From: Enrique Amodeo <eamodeoru...@gmail.com>
Date: Thu, 13 Sep 2012 17:40:54 +0200
Local: Thurs, Sep 13 2012 11:40 am
Subject: Re: [api-craft] Do I use PUT?
Hi Indu, the correct thing to do is to send the parameters inside the
request body, not in the URL. Probably request.getParameter will not
understand the body unless you encode them the same way you use in the
URL (use mime type "application/x-www-form-urlencoded").
I suggest you to use a JAX-RS implementation instead the plain servlet stack.
Cheers,
Enrique Amodeo


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Indu  
View profile  
 More options Sep 14 2012, 1:38 am
From: Indu <indu9...@gmail.com>
Date: Thu, 13 Sep 2012 22:38:49 -0700 (PDT)
Local: Fri, Sep 14 2012 1:38 am
Subject: Re: [api-craft] Do I use PUT?

Enrique,

        I used the content type application/x-www-form-urlencoded for PUT
still I don't get it

Thanks
Indu


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »