Shopify apps - how to get all customers across all pages

Highlighted
New Member
1 0 0

I can only get customers on page 1 by default. I am using PHP and Laravel.

But I have more than one pages and I want to retrieve all customers on these pages dynamically.

I know I can get customers on next page e.g. page 2 like GET /admin/customers.json?page=2, but I want this to be dynamically done.

can anybody please help me with this?

Thank you.

So far I am here.

 

 

<?php

use GuzzleHttp\Client;
$url = "https://" . $this->api_key . ":" . $this->password . "@" . $this->shop;
$client = new Client();
$response = $client->request('GET', $url . "/admin/customers.json");
$body = $response->getBody();
$content = $body->getContents();
$customers= json_decode($content, true);
echo '<pre>'; print_r($customers); echo '</pre>';
 
0 Likes