Calling REST API via MS Access / VBA

I have an MS Access application that is hosted on a Remote Server.  One of the features I need to add is the ability to dial phone numbers and have looked at several solutions (as some of you know).  One of the solutions seems ideal as it will dial the required number and then call the users desk-phone (a common practice).  The service provider has a RESET API toolkit available, which looks ideal - but sadly, I have never worked with REST.  

So my question is this.  Will I be able to make a REST API call via VBA/Access as well as pull in the results  (connection time, engaged etc).
Andy BrownDeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

D GCommented:
Habe you tried this one?
vba-tools.github.io/VBA-Web/
0
Andy BrownDeveloperAuthor Commented:
That's a great start - thank you.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

John TsioumprisSoftware & Systems EngineerCommented:
Can you clarify it a bit...you want the Access to call a phone number ?
0
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<Will I be able to make a REST API call via VBA/Access as well as pull in the results  (connection time, engaged etc).>>

 Yes.   REST is nothing more than exchanging strings using HTTP protocol using GET and POST statements.

 Jack Leach has a nice overview here:

https://dymeng.com/web-work-with-vba/

 
 More specifically, you set a reference to the Microsoft XML doc lib, and this gives you what you need.   Below is some example code of doing some CC processing with REST.  Take a look at the last half of that.   All your doing is sending a string and then getting a string in response, which you then parse.

Jim.

 ' Capture the CC

                  ' Set the correct URL
                  'strPostURL = "https://test.authorize.net/gateway/transact.dll"
110               strPostURL = "https://secure.authorize.net/gateway/transact.dll"
                  'strPostURL = "https://developer.authorize.net/tools/paramdump/index.php"

120               strPostSting = ""
125        strPostSting = strPostSting & "x_login=" & URLEncode(strAPILogin) & "&"
126       strPostSting = strPostSting & "x_tran_key=" & URLEncode(strTransactionKey) & "&"
                  'For debugging.
                  'strPostSting = strPostSting & "x_test_request=" & URLEncode("TRUE") & "&"
130               strPostSting = strPostSting & "x_version=" & URLEncode("3.1") & "&"
140               strPostSting = strPostSting & "x_delim_data=" & URLEncode("TRUE") & "&"
150               strPostSting = strPostSting & "x_delim_char=" & URLEncode("|") & "&"
160               strPostSting = strPostSting & "x_relay_response=" & URLEncode("FALSE") & "&"
170               strPostSting = strPostSting & "x_email_customer=" & URLEncode("FALSE") & "&"

180               strPostSting = strPostSting & "x_type=" & URLEncode("PRIOR_AUTH_CAPTURE") & "&"
190               strPostSting = strPostSting & "x_trans_id=" & URLEncode(rs!CCTransactionID) & "&"

                  ' Additional fields can be added here as outlined in the AIM integration
                  ' guide at: http://developer.authorize.net
200               strPostSting = left(strPostSting, Len(strPostSting) - 1)

                  ' We use xmlHTTP to submit the input values and record the response
                  Dim objRequest As New MSXML2.XMLHTTP
210               objRequest.Open "POST", strPostURL, False
220               objRequest.Send strPostSting
230               strPostResponse = objRequest.responseText
                  'Debug.Print strPostResponse
240               Set objRequest = Nothing

                  ' the response string is broken into an array using the specified delimiting character
250               arrResponse = Split(strPostResponse, "|", -1)

260               If arrResponse(0) = 1 Then

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
and in regards to what DG posted, this is the one everyone seems to like to use, although Jack had some comments (and fixes for it) in another one of his blog posts:

https://github.com/VBA-tools/VBA-Web

 But if you don't need JSON (which is just a way of formatting a response string, akin to XML), then you can stick with the simple setup I posted in my last comment.

Jim.
0
Andy BrownDeveloperAuthor Commented:
That looks ideal guys - thank you - quite excited about trying it out.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.