curl / Mailing Lists / curl-users / Single Mail

curl-users

Re: post data syntax confusion

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 31 Aug 2017 23:20:00 +0200 (CEST)

On Thu, 31 Aug 2017, Neil Leathers via curl-users wrote:

> 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

1. Remove "-X POST", that's just superfluous at best
2. You'll probably like to use:

  curl --data-urlencode mandrill_events@filename http://example.com/

> 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.haxx.se/mail/etiquette.html
Received on 2017-08-31