Discussion:
post data syntax confusion
Neil Leathers via curl-users
2017-08-31 21:09:58 UTC
Permalink
I am trying to test an existing call for a third party callback. I am
having difficulty with the syntax.

curl -d mandrill_events=@filename -X POST http://api.cool.haxx.se

Instead of the contents of the file being sent, the value "@filename" is
being sent. Similarly, using "mandrill_events=@-" and "mandrill_events=-"
with a redirect both fail. Using -F is not acceptable since it doesn't
match the format used by the third party. What is the correct syntax for
uploading a file as a named parameter using a --data variant?


(For reference: Centos 7
$ curl -V
curl 7.29.0 (x86_64-redhat-linux-gnu) libcurl/7.29.0 NSS/3.21 Basic ECC
zlib/1.2.7 libidn/1.28 libssh2/1.4.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3
pop3s rtsp scp sftp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz
unix-sockets
)

Neil
Daniel Stenberg
2017-08-31 21:20:00 UTC
Permalink
Post by Neil Leathers via curl-users
I am trying to test an existing call for a third party callback. I am
having difficulty with the syntax.
1. Remove "-X POST", that's just superfluous at best
Post by Neil Leathers via curl-users
What is the correct syntax for uploading a file as a named parameter using a
--data variant?
--data only supportx @file and then you need to format that file correctly.

--data-urlencode supports the version I show above, but then it also URL
encodes the contents read from the file.
--
/ daniel.haxx.se
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.
Loading...