Pagination in RPCs

I have an API which returns 25 files per page and there are a total of 4598 files.
Now I have an RPC for fetching these files so that they can be used in an action. But the problem is with increasing the limit.

Let’s say I increase the limit to something like 5000, in this case the RPC fails with an error “Request timed out”. I followed the docs on pagination in RPCs and this is the code I came with

{
	"url": "/files",
	"method": "GET",
	"qs": {
		"limit": 25
	},
	"response": {
		"iterate": "{{body.data}}",
		"output": {
			"label": "{{item.title}} {{length(body.data)}}",
			"value": "{{item.id}}"
		},
		"limit": 75
	},
	"pagination": {
		"qs": {
			"page": "{{pagination.page}}"
		}
	}
}

But this doesn’t seem to work since I am just getting 75 files. Is there a way to keep getting the data without the request being timed out, similar to how a load more button works.

I have done this same thing in Zapier and I was able to use a load more button in the select dropdown out of the box. Is there any way to the same in make as well?

The Max Execution Timeout for RPC is 40 seconds, which means, that all the calls executed within the RPC call should not take more than 40 seconds altogether. This is to ensure that the RPC will not stuck in infinity.

It might also be useful to consider the goal of automation. When it comes to designing a scenario, in most cases, you will not be mapping one and single file. Instead, you will dynamically map a file that is the subject of the run.

Does your API support searching files instead of listing? If so, you can implement a Search RPC instead, with no need to work with extensive pagination. Check the implementation here.

3 Likes