Unable to get orders using Link

Unable to get orders using Link

SLL
New Member
8 0 0

First request:

https://XXX-ie.myshopify.com/admin/api/2019-07/orders.json?status=open&financial_status=any&limit=10...


brings back a page of orders as expected:

{\"orders\":[{\"id\":3014249775... blah
...


From "Link" in Response.Headers, I get:

"<https://XXX-ie.myshopify.com/admin/api/2019-07/orders.json?limit=10&page_info=eyJmaW5hbmNpYWxfc3RhdH...>; rel=\"next\""

 

However, when I then try to use this URL to get the next batch of orders eg:

https://XXX-ie.myshopify.com/admin/api/2019-07/orders.json%3Flimit=10&page_info=eyJmaW5hbmNpYWxfc3Rh...


the response I get is this (with data blatted of course):

"<html>\n <body>\n <noscript>\n <a href=\"https://accounts.shopify.com/oauth/authorize?client_id=XXX&amp;destination_uuid=8ec0793a-6e17-4586-8... </noscript>\n\n <script type=\"text/javascript\" defer>\n window.location = \"https:\\/\\/accounts.shopify.com\\/oauth\\/authorize?client_id=7ee65a63608843c577db8b23c4d7316ea0a01bd2f7594f8a9c06ea668c1b775c\\u0026destination_uuid=8ec0793a-6e17-4586-8b6a-9
4ddc6a4feec\\u0026nonce=54c1063fee993e5d08a8ca2cb7f11e4e\\u0026prompt=merge\\u0026redirect_uri=https%3A%2F%XXX-ie.myshopify.com%2Fadmin%2Fauth%2Fidentity%2Fcallback\\u0026response_type=code\\u0026scope=email%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fdestinations.readonly%20openid%20profile%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fpartners.collaborator-relationships.readonly%20https%3A%2F%2Fapi.shopify.com%2Fauth%2Fbanking.manage\\u0026state=f1c9452596b096f03427f9111cb566e1\\u0026ui_locales=en\\u0026ux=shop%20new_design_language\";\n </script>\n </body>\n</html>\n"


I don't understand what i am doing wrong.  The second call should bring back the next batch of orders...!!!???

 


Sai.

Replies 4 (4)
SLL
New Member
8 0 0

I am not going mad.  The 2nd request simply fails as described in my original post.

syf_
Shopify Staff
95 21 25

Hi Sai,

Looking at the response you received, I believe this might be an authorisation issue. What it looks like is the user is not logged in so a redirect to the login page occurs. Could you confirm if you have an active session while trying to use the link for the next page. Also could you try clearing any cookies you have before making the request to see if that helps.

If you're still unable to access the orders, could you provide me with an X-Request-Id which is found in the response header and I'll be able to look into this a bit more for you.

Best,
Seth.

syf_ | Developer 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

SLL
New Member
8 0 0

Hi Seth,

Thank you for the offer but I managed to resolve the issue thanks to that Shopify article and something on StackOverflow which mention that I must only send certain parameters eg PageInfo and Limit in subsequent requests.

It turned out that my initial request was fine when setting up the parameters for the order filter object (removing Page of course)

 

C# code snippets

...

orderFilter = new ShopifyDataStructures.Filters.OrderFilter
{
Status = "open",
FinancialStatus = "",
UpdatedAtMin = Convert.ToDateTime(updatedAfter),
Limit = 25
};

...

But then I had to parse the response and extract from it the Link info... AND also modify the order filter object and set only PageInfo and Limit for subsequent requests:

...

orderFilter = new ShopifyDataStructures.Filters.OrderFilter
{
PageInfo = OrderService.ParsedListResult.NextInfo,
Limit = 25
};

...

 

This worked!

And yes, the API version was set to "2019-07".

 

So happy days.