Shopify new API next page issue | page_info => invalid value
Shopify API version 2019-07 you do indeed need to use cursor-based pagination.
First make a normal API call, include the header response.
Then in the header response API, you will see the "link" parameter with rel next or previous.
Extract the page_info and then make another call with page_info.
The first API call is something like this:
https://.....@abc.myshopify.com/admin/api/2019-10/products.json?limit=2&published_status=published
To get header response from API response :
function getheaderarray($apiresponse){
$data = explode("\n",$apiresponse);
$headers['status'] = $data[0];
array_shift($data);
foreach($data as $part){
$middle = explode(":",$part,2);
if ( !isset($middle[1]) ) { $middle[1] = null; }
$headers[trim($middle[0])] = trim($middle[1]);
}
return $headers;
}
Then the second API call is something like this:
https://.....@abc.myshopify.com/admin/api/2019-10/products.json?limit=2&page_info=abcdsf21asdf3afdfdfd1safd51s3f1x32ref4asdj
When you make the second call, do not add any filers as the filters will be applied from the first call.
FYI: if your testing in a browser due to the way the link is in angle brackets, it will be hidden, so just view source code in your developer environment.