Focusing on managing products, variants, and collections through the API.
I have a private app the makes calls to the products.json and paginates through the results using the now depreciated method. I am trying to use the new 2019-10 api version but when I make a call to {my store address}/admin/api/2019-10/products.json the link header value is empty.
...
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT:1/80
X-Shopify-Shop-Api-Call-Limit:1/80
X-Shopify-API-Version:2019-10
Link:; rel="next"
...
I have tried adding ?limit=250 and some other variations but the link header still returns empty.
Solved! Go to the solution
This is an accepted solution.
@JamesTankersley wrote:I have a private app the makes calls to the products.json and paginates through the results using the now depreciated method. I am trying to use the new 2019-10 api version but when I make a call to {my store address}/admin/api/2019-10/products.json the link header value is empty.
...
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT:1/80
X-Shopify-Shop-Api-Call-Limit:1/80
X-Shopify-API-Version:2019-10
Link:; rel="next"...
I have tried adding ?limit=250 and some other variations but the link header still returns empty.
@JamesTankersley : you might be able to see the answer here: https://community.shopify.com/c/Shopify-APIs-SDKs/Help-with-cursor-based-paging/td-p/568779
This is an accepted solution.
@JamesTankersley wrote:I have a private app the makes calls to the products.json and paginates through the results using the now depreciated method. I am trying to use the new 2019-10 api version but when I make a call to {my store address}/admin/api/2019-10/products.json the link header value is empty.
...
HTTP_X_SHOPIFY_SHOP_API_CALL_LIMIT:1/80
X-Shopify-Shop-Api-Call-Limit:1/80
X-Shopify-API-Version:2019-10
Link:; rel="next"...
I have tried adding ?limit=250 and some other variations but the link header still returns empty.
@JamesTankersley : you might be able to see the answer here: https://community.shopify.com/c/Shopify-APIs-SDKs/Help-with-cursor-based-paging/td-p/568779
@homiebe Yes indeed I was having the same issue, I was emailing myself the results of the headers to check their values before I began in earnest and it was blank. The brackets were causing my email client to try and render the value as html. Thanks for the link!
$curl = curl_init();
curl_setopt_array($curl,
array( CURLOPT_URL => 'https://your-store.myshopify.com/admin/api/2023-07/products.json?fields=variants%2Cid&limit=2',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HEADER => 1,
CURLOPT_HTTPHEADER => array(
'X-Shopify-Access-Token: your_token' ),
));
$response = curl_exec($curl);
$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$header = htmlspecialchars(substr($response, 0, $header_size));
var_dump($header);
die;
curl_close($curl);
Below 2 lines are game changers these will fix the issue
$header_size = curl_getinfo($curl, CURLINFO_HEADER_SIZE);
$header = htmlspecialchars(substr($response, 0, $header_size));
Ref:
https://miraclewebsoft.com/shopify-rest-api-pagination-link-empty/
- Your Coffee Tip can create magic in coding ☕✨
- Seeking a Shopify Certified Developer? Contact us Shopify Verified partners