Questions tagged [put]

PUT is a HTTP method which requests that the enclosed entity be stored under the supplied URL.

PUT is a HTTP method which requests that the enclosed entity be stored under the supplied URL. If the URL refers to an already existing resource, the enclosed entity should be considered as a modified version of the one residing on the origin server. If the URL does not point to an existing resource, and that URL is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URL.

References- apache.org, w3.org

2236 questions
6265
votes
42 answers

What is the difference between POST and PUT in HTTP?

Background Information Analysis: According to RFC 2616, § 9.5, POST is used to create a resource: The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by…
alex
  • 74,215
  • 9
  • 49
  • 57
1212
votes
16 answers

Use of PUT vs PATCH methods in REST API real life scenarios

First of all, some definitions: PUT is defined in Section 9.6 RFC 2616: The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD…
Dmitry Kudryavtsev
  • 16,354
  • 4
  • 25
  • 32
1036
votes
19 answers

What's the difference between a POST and a PUT HTTP REQUEST?

They both seem to be sending data to the server inside the body, so what makes them different?
fuentesjr
  • 50,920
  • 27
  • 77
  • 81
613
votes
14 answers

How to send a PUT/DELETE request in jQuery?

GET:$.get(..) POST:$.post().. What about PUT/DELETE?
user198729
  • 61,774
  • 108
  • 250
  • 348
568
votes
14 answers

Should a RESTful 'PUT' operation return something....

I was wondering what people's opinions are of a RESTful PUT operation that returns nothing (null) in the response body.
AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152
255
votes
10 answers

What is the main difference between PATCH and PUT request?

I am using a PUT request in my Rails application. Now, a new HTTP verb, PATCH has been implemented by browsers. So, I want to know what the main difference between PATCH and PUT requests are, and when we should use one or the other.
user3276063
  • 2,583
  • 2
  • 13
  • 7
228
votes
14 answers

Is there any way to do HTTP PUT request in Python?

I need to upload some data to a server using HTTP PUT method in Python. From my brief reading of the urllib2 docs, it only does HTTP POST. Is there any way to do an HTTP PUT in Python?
Amandasaurus
  • 58,203
  • 71
  • 188
  • 248
154
votes
2 answers

RAW POST using cURL in PHP

How can I do a RAW POST in PHP using cURL? Raw post as in without any encoding, and my data is stored in a string. The data should be formatted like this: ... usual HTTP header ... Content-Length: 1039 Content-Type: text/plain 89c5fdataasdhf…
The Unknown
  • 19,224
  • 29
  • 77
  • 93
143
votes
8 answers

How to send PUT, DELETE HTTP request in HttpURLConnection?

I want to know if it is possible to send PUT, DELETE request (practically) through java.net.HttpURLConnection to HTTP-based URL. I have read so many articles describing that how to send GET, POST, TRACE, OPTIONS requests but I still haven't found…
Matrix
  • 7,477
  • 14
  • 66
  • 97
119
votes
6 answers

In REST is POST or PUT best suited for upsert operation?

I keep a key-value storage in the server for the client. If the user sends key "k1", then I upsert it to the database. Is this considered POST or PUT? Also I have another operation that removes all existing keys and adds the new key. Is this POST or…
Jimmy
  • 10,427
  • 18
  • 67
  • 122
117
votes
14 answers

How to send a POST request with BODY in swift

I'm trying to make a post request with a body in swift using Alamofire. my json body looks like : { "IdQuiz" : 102, "IdUser" : "iosclient", "User" : "iosclient", "List":[ { "IdQuestion" : 5, "IdProposition":…
Stranger B.
  • 9,004
  • 21
  • 71
  • 108
98
votes
4 answers

PHP cURL HTTP PUT

I am trying to create a HTTP PUT request with cURL and I can't make it work. I've read many tutorials but none of them actually worked. Here's my current code: $filedata = array('metadata' => $rdfxml); $ch = curl_init($url); $header = "Content-Type:…
user601513
  • 981
  • 1
  • 7
  • 3
89
votes
7 answers

What is the syntax for adding an element to a scala.collection.mutable.Map?

What is the syntax for adding an element to a scala.collection.mutable.Map ? Here are some failed attempts: val map = scala.collection.mutable.Map map("mykey") = "myval" map += "mykey" -> "myval" map.put("mykey","myval")
Koala3
  • 2,203
  • 4
  • 20
  • 15
83
votes
7 answers

Java map.get(key) - automatically do put(key) and return if key doesn't exist?

I am sick of the following pattern: value = map.get(key); if (value == null) { value = new Object(); map.put(key, value); } This example only scratches the surface of the extra code to be written when you have nested maps to represent a…
Sridhar Sarnobat
  • 25,183
  • 12
  • 93
  • 106
81
votes
4 answers

Test file upload using HTTP PUT method

I've written a service using HTTP PUT method for uploading a file. Web Browsers don't support PUT so I need a method for testing. It works great as a POST hitting it from a browser. update: This is what worked. I tried Poster but it suffers from the…
Speck
  • 2,259
  • 1
  • 20
  • 29
1
2 3
99 100