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
32
votes
4 answers

Should I use PUT method for update, if I also update a timestamp attribute

According to REST style, it's generally assumed that HTTP POST, GET, PUT, and DELETE methods should be used for CREATE, READ, UPDATE and DELETE (CRUD) operations. But if we stick to the HTTP method definitions, it might not be so clear. In this…
opensas
  • 60,462
  • 79
  • 252
  • 386
32
votes
2 answers

RESTful API design: should unchangable data in an update (PUT) be optional?

I'm in the middle of implementing a RESTful API, and I am unsure about the 'community accepted' behavior for the presence of data that can not change. For example, in my API there is a 'file' resource that when created contains a number of fields…
Blake Senftner
  • 756
  • 1
  • 8
  • 24
32
votes
5 answers

How to receive a file via HTTP PUT with PHP

This is something that has been bugging me for a while.. I'm building of a RESTful API that has to receive files on some occasions. When using HTTP POST, we can read data from $_POST and files from $_FILES. When using HTTP GET, we can read data from…
Maurice
  • 4,829
  • 7
  • 41
  • 50
27
votes
4 answers

hadoop fs -put command

I have constructed a single-node Hadoop environment on CentOS using the Cloudera CDH repository. When I want to copy a local file to HDFS, I used the command: sudo -u hdfs hadoop fs -put /root/MyHadoop/file1.txt / But,the result depressed me: put:…
skfeng
  • 669
  • 2
  • 7
  • 15
26
votes
3 answers

Using PUT method with PHP cUrl Library

I'm able to run the following curl command (at the command line) successfully: curl -XPOST --basic -u user:password -H accept:application/json -H Content-type:application/json --data-binary '{ "@queryid" : 1234 }' http://localhost/rest/run?10 Here…
user151419
25
votes
3 answers

How do I access PHP REST API PUT data on the server side?

-- Question -- I am just starting out with the REST API and am getting pretty confused. This is what my PHP cRUL client-side looks like for a PUT. case 'PUT': curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($handle,…
Shylor
  • 446
  • 1
  • 6
  • 11
25
votes
3 answers

link_to update (without form)

I want a link to update a resource, without using an HTML form. Routes: resources :users do resources :friends end Rake routes: user_friend GET /users/:user_id/friends/:id(.:format){:action=>"show", :controller=>"friends"} PUT…
Joe
  • 1,747
  • 3
  • 17
  • 24
25
votes
4 answers

How to get hadoop put to create directories if they don't exist

I have been using Cloudera's hadoop (0.20.2). With this version, if I put a file into the file system, but the directory structure did not exist, it automatically created the parent directories: So for example, if I had no directories in hdfs and…
owly
  • 251
  • 1
  • 3
  • 4
24
votes
2 answers

How are PUT parameters passed to a page?

I can't find a precise answer on that question : Are parameters which are sent by PUT passed in the URL, or in the HTTP header ? I think it's the HTTP header, but when I submit my form with the PUT method, it appends the parameters to the URL !
DKF
  • 407
  • 3
  • 5
  • 10
23
votes
2 answers

HTTP PUT request in Python using JSON data

I want to make PUT request in Python using JSON data as data = [{"$TestKey": 4},{"$TestKey": 5}] Is there any way to do this? import requests import json url = 'http://localhost:6061/data/' data = '[{"$key": 8},{"$key": 7}]' headers =…
amar19
  • 373
  • 1
  • 3
  • 16
22
votes
3 answers

Is it okay to use an HTTP DELETE to deactivate a record?

I'm building a RESTful API command to deactivate a user record. Is it kosher to use DELETE to do this or should this be a PUT, since the record is being updated to "deactivated" status? Or is it just a matter of taste?
abeger
  • 6,766
  • 7
  • 41
  • 58
21
votes
1 answer

Upload a file using an API PUT request

I'm building an API in PHP. One of the methods is place.new (PUT request). It expects several string fields, and it also expects an image. However I can't get it working. With a POST request it was easy, but I'm not sure how to do it with a PUT and…
fesja
  • 3,313
  • 6
  • 30
  • 42
21
votes
1 answer

Spring/RestTemplate - PUT entity to server

Please look at this simple code: final String url = String.format("%s/api/shop", Global.webserviceUrl); RestTemplate restTemplate = new RestTemplate(); restTemplate.getMessageConverters().add(new MappingJackson2HttpMessageConverter()); HttpHeaders…
user1209216
  • 7,404
  • 12
  • 60
  • 123
20
votes
1 answer

How can I send an HTTP PUT request in Ruby?

I am trying to send a PUT request to a particular URL, and have thus far been unsuccessful in doing so. If I were doing it through an HTTP requester GUI, such as this one, it would be as simple as doing a PUT on the following…
finiteloop
  • 4,444
  • 8
  • 41
  • 64
19
votes
3 answers

HTTP Requests, body vs param vs headers vs data

I am new to HTTP requests (GET, POST, PUT, ETC.) and I am having some issues understanding the "anatomy" of these procedures. What exactly is the difference between the body and the data? Are they the same thing? Or are headers the same thing as the…
DCS
  • 393
  • 1
  • 4
  • 12