troubleshooting Question

Use MS Access VBA to create http post request

Avatar of Rick Rudolph
Rick RudolphFlag for United States of America asked on
Microsoft AccessXMLVBAGit
14 Comments1 Solution272 ViewsLast Modified:
I am trying to send http requests to the API provided by test what I was doing, I used Git BASH, and the following command completed correctly (I have changed the key and some of the user / document information, but the syntax is exactly as I sent it):

curl -u "9Ca9C0972a4e1ae439Cee8e5d54CCa881031ba247e085807a847aa86Ca080d6a:" "" -F "title=rjr.docx" -F "subject=Rick's Test Document" -F "message=Please sign this contract" -F "signers[0][email_address]" -F "signers[0][name]=Rick Rudolph" -F "file[0]=@c:/docpath/rjr.docx" -F "test_mode=1"

I opened up a VBA module, and set a reference to the Microsoft XML 6.0 library. Then I tried the following:

Public Function TestAPI()

Dim StrAPI As String
Dim request As MSXML2.ServerXMLHTTP60
StrAPI = " -u '9Ca9C0972a4e1ae439Cee8e5d54CCa881031ba247e085807a847aa86Ca080d6a:' '' -F 'title=rjr.docx' -F 'subject=Rick's Test Document' -F 'message=Please sign this contract' -F 'signers[0][email_address]' -F 'signers[0][name]=Rick Rudolph' -F 'file[0]=@c:/docpath/rjr.docx' -F 'test_mode=1'"
Set request = New ServerXMLHTTP60
request.Open "Post", StrAPI, False
Debug.Print request.StatusText

End Function

This code created an error at :  request.Open "Post", StrAPI, False

The error was:
runtime error '-2147012890 (80072ee6)
System error: -2147012890

The only change I made to the string that worked in Curl was to change the double quotes to single quotes inside the string.

Thanks in advance as this is a stumbling block in a new process we are trying to develop.
Rick Rudolph

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 14 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 14 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros