curl: PUT

Testing curl PUT commands.

Start by creating an HTTP PUT server:

# python -m SimpleHTTPPutServer 8080
import SimpleHTTPServer
import BaseHTTPServer

class SputHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
    def do_PUT(self):
        print self.headers
        length = int(self.headers["Content-Length"])
        path = self.translate_path(self.path)
        with open(path, "wb") as dst:

if __name__ == '__main__':

and run with `python`


curl -XPUT -H "Content-Type: application/json" http://localhost:8000 -d '{"test": null}'

and now you can mess around creating arbitrary PUT commands.


  1. spaces don’t matter between -H and quotes.


is the same as:

-H "Content-Type

2. Double quotes == Single quotes. E.g.

-H'Content is OK

3. argument to -dmust be surrounded in quotes. E.g.

-d 'test=test' is OK.

-d test=test is NOT OK.

E.g. see examples here:


Leave a Reply

Your email address will not be published. Required fields are marked *