post data in meteorjs when using curl post data in meteorjs when using curl curl curl

post data in meteorjs when using curl


basically -d for curl means read the file and use its content as data

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. Multiple files can also be specified. Posting data from a file named 'foobar' would thus be done with --data @foobar. When --data is told to read from a file like that, carriage returns and newlines will be stripped out. If you don't want the @ character to have a special interpretation use --data-raw instead.

in order to send the file itself youll need something like -F

(HTTP) This lets curl emulate a filled-in form in which a user has pressed the submit button. This causes curl to POST data using the Content-Type multipart/form-data according to RFC 2388. This enables uploading of binary files etc. To force the 'content' part to be a file, prefix the file name with an @ sign. To just get the content part from a file, prefix the file name with the symbol <. The difference between @ and < is then that @ makes a file get attached in the post as a file upload, while the < makes a text field and just get the contents for that text field from a file.

Example, to send your password file to the server, where 'password' is the name of the form-field to which /etc/passwd will be the input:

curl -F password=@/etc/passwd www.mypasswords.com

in your case probably use -Fcurl --ipv4 http://localhost:3000/api/tests/1 -F data=

if you want to file to be uploaded as a file use -F data=@test.csv


This works!!

curl --ipv4 --data-urlencode  "csv@test.csv"  http://localhost:3000/api/tests/1 

Hope this helps someone :)