Send File Contents with Curl
Snippet
Yeah, kitt finished writing this at 12:15 on 23 July 2018
Testing out new API endpoints, and want to use curl
to do it, use the --data-binary
and @filename
syntax.
This sends the file IN the body.
# use the --data-binary to leave newlines intact, saw with images curl --data-binary "@/path/to/filename" https://api.example.com/posts # If you really need newlines stripped (eh?), use --data curl --data "@/path/to/file" https://api.example.com/posts