All Pelcro Core APIs have support for bulk fetches via "list". For instance, you can list the invoices, subscriptions, addresses, coupons, etc. These list API methods share a common structure, taking two parameters: page
and limit
.
Calling a list API method on any resource without specifying these parameter will return 10 records per page by default, yet it is possible to change this setting to return up to a maximum of 100 records per page, as an example:
use GuzzleHttp\Client;
$site_id = 0; // (int) your site id here
$api_key = '' // (string) your api key here
$per_page = 100; // (int) number of records per page
$config = [
'base_uri' => 'https://www.pelcro.com/api/v1/core/subscriptions?limit=' . $per_page
];
$client = new Client($config);
$options = [
'query' => [
'site_id' => $site_id,
],
'headers' => [
'Accept' => 'application/json',
'Authorization' => 'Bearer ' . $api_key
]
];
$response = $client->request('GET', $uri, $options);