0

I am trying to send a multipart form request thru curl but it seems to be timing out on the server. I am not a curl wiz and am trying to figure out what I am doing wrong. I can post thru postman just fine and if I copy the curl request out of postman and tweak to escape the / and ' characters, it seems like it should work and looking at the logs the requests coming from both look pretty dang close so I must be missing something obvious. Here is my request:

curl -v -X POST ^
  http://localhost:8096/api/sys/cfna-notifications/v1/email-notifications ^
  -H "Accept: */*" ^
  -H "Accept-Encoding: gzip, deflate" ^
  -H "Cache-Control: no-cache" ^
  -H "Connection: keep-alive" ^
  -H "Content-Length: 977" ^
  -H "Content-Type: multipart/form-data" ^
  -H "Host: localhost:8096" ^
  -H "cache-control: no-cache" ^
  -H "client_id: mmmm" ^
  -H "client_secret: dddd" ^
  -H "content-type: multipart/form-data" ^
  -F transactionId=asdfd-213sdf-sdf4-2323kjds ^
  -F parentTransactionId=12345 ^
  -F businessProcess=test ^
  -F toAddresses=bogartlisa@cfna.com ^
  -F "subject=test this notification" ^
  -F "body=body of notification email"

maybe a stupid question but do I need to do something to terminate the final part of the multipart request???

  • tried the following and still times out – lisa bogart Oct 31 '19 at 21:26
  • curl -v -X POST ^ http://localhost:8096/api/sys/cfna-notifications/v1/email-notifications ^ -H "Content-Length: 977" ^ -H "Host: localhost:8096" ^ -H "client_id: mmmm" ^ -H "client_secret: dddd" ^ -H "content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" ^ -F transactionId=asdfd-213sdf-sdf4-2323kjds ^ -F parentTransactionId=12345 ^ -F businessProcess=test ^ -F toAddresses=bogartlisa@cfna.com ^ -F "subject=test this notification" ^ -F "body=body of notification email" – lisa bogart Oct 31 '19 at 21:26

1 Answers1

0

No, you don't - curl knows how many parts you've specified and will "end" the series appropriately itself when sending the data.

(Bonus: remove the -X POST, that's just bad practice.)

It is very possible that one of your -H provided headers is screwing things up for curl. Remove all of them except the two for "client*" stuff and I think things might go better.

Daniel Stenberg
  • 54,736
  • 17
  • 146
  • 222