Curl multiple data in one POST command

18,671

You should use -d param

check a man page http://curl.haxx.se/docs/manpage.html

If you start the data with the letter @, the rest should be a file name to read the data from, or - if you want curl to read the data from stdin. The contents of the file must already be URL-encoded. Multiple files can also be specified. Posting data from a file named 'foobar' would thus be done with --data @foobar.

Try to specify a full path to your file.

Share:
18,671
Rami
Author by

Rami

I am a Data Scientist with experience in Machine Learning, Big Data Analytics and Computer Vision. I am currently working on advanced Machine Learning technologies for Mobile Operators Subscribers Analytics to optimise advertisement, recommendation and costumer care services. Co-founder and organiser of the Lifelogging@Dublin Meetup group, I am an active long-term Lifelogger with particular interest in human behaviour tracking and analytics.

Updated on June 25, 2022

Comments

  • Rami
    Rami almost 2 years

    Can anyone tell me if I can (in the command line) issue a POST command that contains a file and other parameters?

    I am trying to do something like:

    curl -X POST -F "key=myKey&[email protected]"  http://localhost:8080/myRestService/
    

    I am really new in this domain, so excuse me for my basic question. But it does not seems to work well. Any suggestion? Tank you very much