Given a Curl command :
curl https://URL
-u xxxxxxxxxxxxxxxxxxxxxx:
-X POST
-F "source_file=@/tmp/my.doc"
-F "DoSomething=checkit"
The expected result is a Json string. How can this be used in VBA Excel macro utilizing a "WinHttp.WinHttpRequest.5.1" object. Is the file "my.doc" transfered by name or by a Byte array ?
I manged to convers a simple Curl command:
curl https://URL
-u xxxxxxxxxxxxxxxxxxxxxx:
into the following code which works fine.
With CreateObject("WinHttp.WinHttpRequest.5.1") .Open "GET", URL, False .SetCredentials "xxxxxxxxxxxxxxxxxxxxxx", "", 0 .send If .Status <> 200 Then If MsgBox(.responseText, vbOKOnly + vbCritical, "Error") = vbOK Then Exit Sub End If Else ss = .responseBody BodyData = StrConv(ss, vbUnicode) Set Json = JsonConverter.ParseJson(BodyData) End If
The same is needed for the above Curl command. Please help .