According to the official shopify documentation , “https://shopify.dev/docs/api/usage/pagination-rest#make-a-request-for-paginated-data”
there will be a link to the next page in the response header , but in my practical scenario , theres no link available , am i missing somthing ?
there are almost 60 products in my store,
my first api call returns the exact number of product i set as $perPage value properly, but i can not find the value of “link” to get the URL for the next page of results.
Thanks in advance.
$productEndpoint = "https://".$this->shop."/admin/api/2024-01/products.json";
$perPage = 20; // Set the desired number of products per page
$allProducts = [];
do {
// Append query parameters for per_page and page
$url = $productEndpoint."?limit=".$perPage;
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json',
'X-Shopify-Access-Token: ' . $this->accessToken,
]);
$response = curl_exec($ch);
$headers = curl_getinfo($ch);
$productDataArray = json_decode($response, true);
echo "All Headers:n";
var_dump($headers);
// Close the cURL connection
curl_close($ch);
} while (true);