In CURL, I can use this line
curl --data 'DataToBeSent' https://example.com/resource.cgi
I am struggling to convert such line to be used in VBA and this is my try till now
Sub POST_Method_Example()
Dim myMessage As String
myMessage = "DataToBeSent"
With CreateObject("MSXML2.ServerXMLHTTP")
.Open "POST", "https://example.com/resource.cgi"
.setRequestHeader "Content-Type", "multipart/form-data; boundary==------------------------d74496d66958873e"
.send sData(myMessage)
Debug.Print .ResponseText
End With
End Sub
But this throws an error at the json response. How can I make this works for VBA?
I can get it work on postman by assigning the url and in Body tab I selected "form-data" and assign KEY: text and VALUE: DataToBeSent This returns a successful response.