Basic API call using VBA?

Highlighted
New Member
1 0 0

Really struggling here wrt constructing the initial API call (for Shopify) ...there's not a lot of related info via a google search.

Has anyone got any code to get me off the ground?

All I seek is the most basic of code to construct a proper formatted get request using Shopify API key (username) & secret key (password)

here's the URL that works... (this is just a test site that will be deleted in a week or so, so I'm not worried about sharing the keys)

https://removed:removed@removed.myshopify.com/admin/api/2021-01/orders


(in other words if you copy that URL into a browser you don't get an error)

I'm clearly missing the point re how to reconstruct the above in VBA, here's what I've done (which isn't working)....

 

'login = removed
'password = removed
strLogin = "https://removed.myshopify.com/admin/api/2021-01/orders.json/authenticateUser?login=removed&apiKey=removed"

Set XMLHTTP = CreateObject("MSXML2.ServerXMLHTTP.6.0")
XMLHTTP.Open "GET", strLogin
XMLHTTP.setRequestHeader "Content-Type", "text/xml"
XMLHTTP.send

strReturn = XMLHTTP.responseText
Debug.Print strReturn

 

 

 

0 Likes
Highlighted
Shopify Staff
Shopify Staff
644 78 141

Hey @HankMcSpank,

Please don't share API credentials on the forums, even for test stores. I recommend rotating those exposed credentials.

This doc contains examples showing how to pass credentials for API calls using basic auth. They can be passed in the URL if your client supports it, otherwise you can include an Authorization header field with your calls. The doc shows the correct syntax for this.

JB | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes