Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
506 views
in Technique[技术] by (71.8m points)

Curl Newbie needs help w Mac Postman and Curl upload of PDF

I am trying to use the api here:

https://resume-parser.affinda.com/public/docs#operation/createDocument

to upload a pdf using curl. I am trying to just hardcode in a demo pdf on my mac desktop where the file path is:

BootDrive:Users:me:Desktop:test1.pdf

Q: Am I typing the Mac path wrong?

I skipped the variables and entered this below but it fails

  --form "file=@BootDrive:Users:me:Desktop:test1.pdf" 

skipped this
  --form "file=@$PATH_TO_FILE" 


error is...

{
    "file": [
        "The submitted data was not a file. Check the encoding type on the form."
    ],
    "statusCode": 400
}

My curl is:


curl --location --request POST 'https://resume-parser.affinda.com/public/api/v1/documents/' 
--header 'Authorization: Bearer 123xxx123' 
--header 'Accept-Encoding: gzip, deflate' 
--header 'Content-Type: multipart/form-data' 
--header 'accept: */*' 
--form 'file="@BootDrive:Users:me:Desktop:test1.pdf"'


curl from site...

TOKEN="REPLACE_TOKEN"

PATH_TO_FILE="/path/to/file.pdf"

curl --request POST "https://resume-parser.affinda.com/public/api/v1/documents/" 
  --location --compressed 
  --header "Authorization: Bearer 123xxx123" 
  --header "Accept-Encoding: gzip, deflate" 
  --header "Content-Type: multipart/form-data" 
  --form "file=@$PATH_TO_FILE" 
  --header "accept: */*" 

update Curl that does work from Mac terminal:

curl -F file=@/Users/MyName/Desktop/test1.pdf --oauth2-bearer 123xxx123 https://resume-parser.affinda.com/public/api/v1/documents/

but still can not get it working in postman

question from:https://stackoverflow.com/questions/65892817/curl-newbie-needs-help-w-mac-postman-and-curl-upload-of-pdf

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...