Hi.
Is there a way to set a global limit for records returned via rest api? we have alot of records and we feel the api can be abused to slow down the system.
Hi @kech
Unfortunately, there is no way to set a global limit for the REST API.
Here are two workarounds to solve your issue:
- You can use the
limit
parameter for each request where you need a limit, link to the documentation page. - You can globally (not only in REST) limit the maximum number of records issued to a client layer for a specific entity by using the
maxFetchUI
parameter of the Entity Statistics engine, link to the documentation page.
Regards,
Nadezhda.
Hi, is there a way i can set this maybe through an advisor or some other mechanism.
Hi,
You can implement desired limit checks by two different ways.
-
Override the EntitiesControllerManager bean (which executes data loading) in your project. See topic that may help with that: REST Services return View on Update/Create - #3 от пользователя gorbunkov
-
Use AOP to intercept calls to the EntitiesController (it’s a Spring MVC controller that receives requests to load entities). You will be able to throw an exception and prevent too much data to be loaded.
See Rest API Performance Stat logs - #3 от пользователя gorbunkov as an example.