Help with Web APIs in Access (1 Viewer)

Telving

New member
Local time
Today, 22:05
Joined
Mar 1, 2017
Messages
2
Hi
Does anyone know if it is possible to use Web APIs from within Access.
I have a search form where I search in different tables that I import into access prior to Searching. I would like to send my keyword to Chemspider.com using their Web API solution.

So if anyone could have a brief look at this info to tell me if it can be used somehow in access and then how I get started in access VBA.

Info from chemspider website:

HTTP GET

The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values.

Code:
GET /Search.asmx/SimpleSearch?query=string&token=string HTTP/1.1
Host: LINK TO WEBSITE

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfInt xmlns="LINK TO WEBSITE">
  <int>int</int>
  <int>int</int>
</ArrayOfInt>



HTTP POST

The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.

Code:
POST /Search.asmx/SimpleSearch HTTP/1.1
Host: LINK TO WEBSITE
Content-Type: application/x-www-form-urlencoded
Content-Length: length

query=string&token=string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<ArrayOfInt xmlns="LINK TO WEBSITE">
  <int>int</int>
  <int>int</int>
</ArrayOfInt>


Thanks
Rasmus T
 

isladogs

MVP / VIP
Local time
Today, 21:05
Joined
Jan 14, 2017
Messages
18,252
I use HTTP GET & HTTP SEND with the Twilio API to send & receive text/voice messages from Access. For example:

Get messages:

Code:
  ' setup the URL
    MessageUrl = GetBaseURL() & "/2010-04-01/Accounts/" & GetMessageAccountSID() & "/Messages"

' setup the request and authorization
    Set http = New MSXML2.XMLHTTP60
   
    http.Open "GET", MessageUrl, False, GetMessageAccountSID(), GetMessageAuthToken()
    http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    http.Send ""

Send Messages:

Code:
 ' setup the URL
    MessageUrl = GetBaseURL() & "/2010-04-01/Accounts/" & GetMessageAccountSID() & "/Messages"
    
    ' setup the request and authorization
    Set http = New MSXML2.XMLHTTP60
    
    http.Open "POST", MessageUrl, False, GetMessageAccountSID(), GetMessageAuthToken()
    http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
        
    PostData = "From=" & URLEncode(FromNumber) _
                & "&To=" & URLEncode(ToNumber) _
                & "&Body=" & Body


The Twilio API is available from https://www.twilio.com/docs/api
It's clear / detailed & their support is excellent

Even if you don't want to do messaging, it may give you useful info
 

Users who are viewing this thread

Top Bottom