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?

link|improve this question

feedback

4 Answers

up vote 8 down vote accepted

wget can't do PUT. Use curl instead, with -T.

link|improve this answer
there's also a wput utility tho it seems limited to FTP. – quack quixote Apr 12 '10 at 8:19
feedback

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
link|improve this answer
feedback

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)
link|improve this answer
feedback

If you dont want to use a file as data, you can do the following

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

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.