API reference
Pagination
Page through long lists of clients, members or tasks in the Quenza API with offset and limit, and follow the next link until the last page.
List clients, List members and List tasks return their records in pages. You choose the page with two query parameters:
limit: how many records you get, from 1 to 100. The default is 20. A larger number counts as 100.offset: how many records to skip from the start. The default is 0.
So ?limit=50&offset=100 returns records 101 to 150.
What a page looks like
Section titled “What a page looks like”Every list answers with the same three parts:
{ "data": [ ... ], "meta": { "limit": 50, "offset": 100, "total": 212 }, "links": { "next": "https://developers.quenza.com/v1/clients?limit=50&offset=150", "prev": "https://developers.quenza.com/v1/clients?limit=50&offset=50" }}dataholds the records of this page.meta.totalis the number of records in all pages together.links.nextis the full URL of the next page, ornullon the last page.links.previs the page before, ornullon the first page.
Get every record
Section titled “Get every record”Follow links.next until it is null. This reads all clients of the workspace, 100 at a time:
async function allClients() { const clients = []; let url = 'https://developers.quenza.com/v1/clients?limit=100'; while (url) { const response = await fetch(url, { headers: { Authorization: `Bearer ${process.env.QUENZA_API_TOKEN}`, Accept: 'application/json' }, }); if (!response.ok) throw new Error(`Quenza API error ${response.status}`); const { data, links } = await response.json(); clients.push(...data); url = links.next; } return clients;}import osimport requests
def all_clients(): clients = [] url = "https://developers.quenza.com/v1/clients?limit=100" headers = {"Authorization": f"Bearer {os.environ['QUENZA_API_TOKEN']}", "Accept": "application/json"} while url: response = requests.get(url, headers=headers) response.raise_for_status() page = response.json() clients += page["data"] url = page["links"]["next"] return clients<?php
require 'vendor/autoload.php';
function allClients(): array{ $http = new GuzzleHttp\Client(['headers' => [ 'Authorization' => 'Bearer ' . getenv('QUENZA_API_TOKEN'), 'Accept' => 'application/json', ]]); $clients = []; $url = 'https://developers.quenza.com/v1/clients?limit=100'; while ($url !== null) { $page = json_decode($http->get($url)->getBody(), true); $clients = array_merge($clients, $page['data']); $url = $page['links']['next']; } return $clients;}Order of the records
Section titled “Order of the records”Clients and members come sorted by last name, then first name. Tasks come newest first. When someone adds a client while you page through the list, the records after it move one place; read the whole list again if you need an exact copy.
Was this article helpful?
Thanks for letting us know.
Thank you. We read every answer and use it to improve this article.