Pagination
Some of our /GET
endpoints support pagination to efficiently handle large sets of data. Pagination allows you to retrieve a subset of results based on specified criteria. Our implementation uses offset and limit parameters.
Parameters
offset Optional integer, default 0 : The number of records to skip before starting to return results. This is used to specify the starting point of the results to be fetched.
limit Optional integer, default 50 : The maximum number of records to return.
Example Request To fetch a subset of results with a specific offset and limit, include the offset and limit parameters in your query string:
- JavaScript
- bash
- .NET
const got = require('got');
const directoryArray = await got.get('https://api.ppd.iopole.fr//v1/directory?value=IOPOLE&offset=5000&limit=50',).json();
curl -X GET "https://api.ppd.iopole.fr//v1/directory?value=IOPOLE&offset=5000&limit=50" -H "Authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: application/json"
using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
class Program
{
static async Task Main(string[] args)
{
string url = "https://api.ppd.iopole.fr//v1/directory?value=IOPOLE&offset=5000&limit=50";
using (HttpClient client = new HttpClient())
{
HttpResponseMessage response = await client.GetAsync(url);
if (response.IsSuccessStatusCode)
{
string responseString = await response.Content.ReadAsStringAsync();
JArray directoryArray = JArray.Parse(responseString);
Console.WriteLine(directoryArray);
}
else
{
Console.WriteLine("Error: " + response.StatusCode);
}
}
}
}
Handling Edge Cases
If the offset value exceeds the total number of records, an empty array will be returned in the data field.
If the limit value is not specified, the default value will be used.
If the offset or limit values are not valid integers, the server will return a 400 Bad Request response.
Notes
The maximum allowed value for limit is 100. Requests specifying a higher limit will be constrained to 100.
Using pagination helps in reducing the amount of data transferred and processed, thereby improving performance.