We replaced page-based pagination for a number of endpoints in the 2019-07 version. This was done in favour of a much more performant method of pagination we’ve also released for these endpoints called cursor-based pagintion. We’ve released this guide on how to make calls using cursor-based pagination. The TLDR is that you need to look for the “Link” response header in your requests. The value of this header will be a link to both the next and previous page of results in the following format.
That being said, you can continue making requests with the page param using the 2019-04 version until it is no longer supported with the release of 2020-04.
Let me know if you have any lingering questions or concerns.
We are not getting Link header in response headers returned by shopify while calling orders api below are the headers we are getting
1.We are calling orders api orders.json which returns orders all fine but we dont have any way to get second page of orders and documentation says we will get link header that will mention page_info param but api is not returning any link header or page_info as you can see below in response headers
HTTP/1.1 200 OK
Date: Mon, 02 Sep 2019 06:04:06 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Set-Cookie: __cfduid=daaa7a5d79a531ae7a3dfa4f59a13dc5d1567404245; expires=Tue, 01-Sep-20 06:04:05 GMT; path=/; domain=.myshopify.com; HttpOnly
X-Sorting-Hat-PodId: 84
X-Sorting-Hat-ShopId: 7382728789
Vary: Accept-Encoding
Referrer-Policy: origin-when-cross-origin
X-Frame-Options: DENY
X-ShopId: 7382728789
X-ShardId: 84
X-Stats-UserId:
X-Stats-ApiClientId: 2972013
X-Stats-ApiPermissionId: 115969425493
X-Shopify-API-Terms: By accessing or using the Shopify API you agree to the Shopify API License and Terms of Use at https://www.shopify.com/legal/api-terms
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT: 1/40
X-Shopify-Shop-Api-Call-Limit: 1/40
X-Shopify-API-Version: 2019-10
Strict-Transport-Security: max-age=7889238
X-Request-Id: c69c7392-e281-4733-9884-775df38d0825
X-Shopify-Stage: production
Content-Security-Policy: default-src 'self' data: blob: 'unsafe-inline' 'unsafe-eval' https://* shopify-pos://*; block-all-mixed-content; child-src 'self' https://* shopify-pos://*; connect-src 'self' wss://* https://*; frame-ancestors 'none'; img-src 'self' data: blob: https:; script-src https://cdn.shopify.com https://checkout.shopifycs.com https://js-agent.newrelic.com https://bam.nr-data.net https://dme0ih8comzn4.cloudfront.net https://api.stripe.com https://mpsnare.iesnare.com https://appcenter.intuit.com https://www.paypal.com https://js.braintreegateway.com https://c.paypal.com https://maps.googleapis.com https://www.google-analytics.com https://v.shopify.com https://widget.intercom.io https://js.intercomcdn.com 'self' 'unsafe-inline' 'unsafe-eval'; upgrade-insecure-requests; report-uri /csp-report?source%5Baction%5D=index&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Forders&source%5Bsection%5D=admin_api&source%5Buuid%5D=c69c7392-e281-4733-9884-775df38d0825
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
X-XSS-Protection: 1; mode=block; report=/xss-report?source%5Baction%5D=index&source%5Bapp%5D=Shopify&source%5Bcontroller%5D=admin%2Forders&source%5Bsection%5D=admin_api&source%5Buuid%5D=c69c7392-e281-4733-9884-775df38d0825
X-Dc: gcp-us-east1,gcp-us-east1
NEL: {"report_to":"network-errors","max_age":2592000,"failure_fraction":0.01,"success_fraction":0.0001}
Report-To: {"group":"network-errors","max_age":2592000,"endpoints":[{"url":"https://monorail-edge.shopifycloud.com/v1/reports/nel/20190325/shopify"}]}
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Server: cloudflare
CF-RAY: 50fd48d78f90d5f8-BOM
If you’re targeting the 2019-10 version of the order index endpoint, you should definitely be seeing a link header assuming there is a next page to be linked to. Does your response set have a second page of results?
I am using this function to navigate to the next link
It’s in VBA but should be easy to translate it.
Function getNextPageURL(ByRef linkHeader As String) As String
Dim linkArray() As String: linkArray = Split(linkHeader, ",")
For Each link In linkArray
link = Trim(link)
Dim linkfields() As String: linkfields = Split(link, ">;")
If linkfields(1) Like "*next*" Then
getNextPageURL = Right(linkfields(0), Len(linkfields(0)) - 1)
Exit Function
Else
getNextPageURL = ""
End If
Next link
End Function
It only finds the next link as I never need to go back
Also I wrote this specifically for Shopify APIs so there are good chances that it won’t work with other applications.
The page parameter was dropped from all the REST Admin API endpoints (Some in the 07/2019 and the rest in the 10/2019 release)
Now in order to navigate the API response you will need to parse the HTTP LINK response header, which will contain if they exists, the URLs to the NEXT and PREVIOUS page. You can also set the LIMIT parameter in the HTTP LINK header.