REST API Limits
When it comes to “limits” in the kintone REST API, you might think of retrieving, creating, updating, or deleting records.
The number of records per app can easily increase depending on how you use it, so you may inevitably encounter this. However, this time we will introduce the limit on the number of apps that can be retrieved.
As of December 2021, the limit for the number of apps that can be retrieved at one time is 100.
While it may be rare for the number of apps to exceed 100, it is important to be able to retrieve them without worrying about the limit, so you do not have to review all past programs when the number of apps exceeds 100.
This time, we will introduce code that retrieves all app information without worrying about the limit.
Source Code
const LIMIT = 100;
const getAllApps = async (offset = 0, _apps = []) => {
const { apps } = await kintone.api(kintone.api.url(`/k/v1/apps`, true), 'GET', {
limit: LIMIT,
offset,
});
const allApps = [..._apps, ...apps];
return apps.length === LIMIT ? getAllApps(offset + LIMIT, allApps) : allApps;
};
Usage
No arguments are required when calling.
const apps = await getAllApps();
for (const app of apps) {
console.log(app);
}