FROM CACHE - en_header

GraphQL occassionally responds with a HTML login - Desktop App (VBA)

Solved
Chris_West
Tourist
4 1 1

Hello Everyone.

A bit of help would be appreciated. 🙂

I've been successfully using the API for years... pulling information into Excel to help me manage draft orders (quotes in my case) . About a month ago, I was pleased with myself as I got GraphQL working to pull in the events held against a draft. I could then count how many times an invoice had been sent and make decisions on the back of that... e.g. offer a last minute discount, delete drafts that had gone stale, etc

The problem I have been experiencing is that at least once a day I get about 1-2hr periods when the GraphQL responds with the HTML of the Shopify login page. This is directly after doing a standard get_drafts API call which works every time.

If I were to try the same API call in a client like Postmaster (Insomnia in my case).. it just works.

Is there some sort of session based auth going on? I can't work out why it's fine for 70% of the time and not for the rest.

Penny for your thoughts please?
Thanks
Chris

Accepted Solution (1)

Accepted Solutions
Chris_West
Tourist
4 1 1

This is an accepted solution.

Just in case anyone else stumbles across this type of issue, I think I have a stable solution.

After a fair amount of trial an error it seems simply changing the VBA reference

Set myObject = CreateObject("Microsoft.XMLHTTP") 

 

to

Set myObject = CreateObject("Msxml2.ServerXMLHTTP")

works.

 

A few weeks in and so far so good.

Thanks
Chris

View solution in original post

Replies 3 (3)
csam
Shopify Staff
Shopify Staff
267 40 45

Hi @Chris_West 

This is most likely being caused by an expired cookie. I would recommend clearing cookies from your app regularly which should prevent this behaviour from occurring.

Regards,

CS | API Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Chris_West
Tourist
4 1 1

Hi @csam 

Thanks for the response. Good thinking!
I'll take a look, but not a great deal of literature around ancient VB and cookies.

 

 

Chris_West
Tourist
4 1 1

This is an accepted solution.

Just in case anyone else stumbles across this type of issue, I think I have a stable solution.

After a fair amount of trial an error it seems simply changing the VBA reference

Set myObject = CreateObject("Microsoft.XMLHTTP") 

 

to

Set myObject = CreateObject("Msxml2.ServerXMLHTTP")

works.

 

A few weeks in and so far so good.

Thanks
Chris