I'm searching for the syntax to write a PUT
operation that upload a file with HTTPie. Please could you point me to the right syntax ? I could not find a way to do so on the official documentation
Asked
Active
Viewed 9,284 times
9

Jakub Roztocil
- 15,930
- 5
- 50
- 52

MaatDeamon
- 9,532
- 9
- 60
- 127
1 Answers
22
To achieve this with httpie, you need to do two things:
- Set the HTTP method to
PUT
, which is trivial:$ http PUT […]
- Pass the contents of the file, for which there are various ways:
$ http PUT httpbin.org/put Content-Type:image/png < /images/photo.png
Request data from a filename (automatically sets the Content-Type
header):
$ http PUT httpbin.org/put @/images/photo.png
$ http --form PUT httpbin.org/put photo=@/images/photo.png

Jakub Roztocil
- 15,930
- 5
- 50
- 52