0

Can anyone help with this curl request? I've tried it a few different ways but every time it can read the data from the file. I've done successful curl GET and Post request with the data in the request but I can't get it to read the file.

curl --location --request POST 'https://xxxxx' \
--header 'Account-Token: xxxxx' \
--header 'Authorization: Token xxxxxx' \
--header 'Content-Type: text/csv' \
--data-binary '@/C:/Users/xxxx/filename.csv'
Error:
Warning: Couldn't read data from file
Warning: "/C:/Users/xxxx/Desktop/filename.csv", this
Warning: makes an empty POST.

Thanks

Yuki Inoue
  • 2,652
  • 4
  • 27
  • 40
unyon
  • 1
  • 1
  • Maybe this could help: https://stackoverflow.com/questions/12667797/using-curl-to-upload-post-data-with-files – jayatubi May 08 '20 at 10:04
  • thanks still have same issue though. Do you have to do anything with the permissions of the file? – unyon May 08 '20 at 15:22
  • What do you mean about the permission? If the file could be read that would be fine. – jayatubi May 09 '20 at 00:03
  • Is this on Windows? I've never seen a Windows C using that format. Try `C:/Users/...` (no leading slash) for Microsoft, or `/C/Users/...` (no colon) for mingw. Or, first `cd/d c:\Users\...` then use a relative name `--data-binary @filename.csv` – dave_thompson_085 May 10 '20 at 10:17
  • same issue either way: ... --data-binary @test.csv {"errors":{"name":["can't be blank"]}} ... --data-binary @C:/Users/unyon/Desktop/curl/test.csv {"errors":{"name":["can't be blank"]}} – unyon May 10 '20 at 15:58

0 Answers0