Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to use Wget to access a RESTful interface, but I can not figure out how to do HTTP PUT with Wget. How can I do it? Or isn't it prossible?

share|improve this question
up vote 23 down vote accepted

Wget can't do PUT. Use cURL instead, with -T.

share|improve this answer
    
there's also a wput utility tho it seems limited to FTP. – quack quixote Apr 12 '10 at 8:19
4  
Wget can now do PUT using --method. – John Henry Oct 19 '14 at 17:42

Since this is REST interface, I think you'd want to use curl with -X PUT, like this:

curl -i -X PUT http://www.example.tld/rest/updateEntity/1234?active=false

Or if you need to "post" data from a file, like an XML:

curl -i -X PUT -H "Content-Type: application/xml; charset=utf-8" -d @"/tmp/some-file.xml" http://www.example.tld/rest/updateEntity
share|improve this answer
wget --method=PUT --body-data=STRING

This is a bit late, but at some point after the original post, they added a "--method" option. I'm not sure when it was added, but see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684189 for details.

share|improve this answer

For me following worked:

curl -T <file-path> <url>

For some reason when I did following it nothing happened (no error as well):

curl -X PUT -d <file-path> <url>         (did not work)
share|improve this answer
    
-d will send the data you entered on the command line, so it will try to PUT file path as text. – che Jan 8 '13 at 16:51

If you don't want to use a file as data, you can do the following.

curl -X PUT -d "something=blabla&somethingelse=blaha" http://www.example.com
share|improve this answer
    
+1 Interesting and helpful, thanks – Jonas Jan 3 '12 at 16:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .