zoneminder icon indicating copy to clipboard operation
zoneminder copied to clipboard

WEB_EVENTS_PER_PAGE does not work using API

Open 0rsa opened this issue 4 years ago • 7 comments

Describe Your Environment Zoneminder 1.34.22 Debian Buster

Describe the bug WEB_EVENTS_PER_PAGE seems to be not used using API /events/index

Steps to reproduce the behavior:

  1. Call documentation example curl -XGET "http://server/zm/api/events/index/StartTime%20>=:2015-05-15%2018:43:56/EndTime%20<=:208:43:56.json"
  2. API returns 100 results

Expected behavior API returns WEB_EVENTS_PER_PAGE items (default is 25)

0rsa avatar Jan 05 '21 13:01 0rsa

Thanks for opening your first issue here! Just a reminder, this forum is for Bug Reports only. Be sure to follow the issue template!

welcome[bot] avatar Jan 05 '21 13:01 welcome[bot]

The API does not follow WEB_EVENTS_PER_PAGE - that is primarily for the console/UI. When it comes to API, we would like to reduce overheads of API calls to get relevant events and that is why it is set to 100.

pliablepixels avatar Jan 14 '21 15:01 pliablepixels

According to the documentation, API respects WEB_EVENTS_PER_PAGE

https://zoneminder.readthedocs.io/en/stable/api.html Return a list of all events http://server/zm/api/events.json Note that events list can be quite large and this API (as with all other APIs in ZM) uses pagination. Each page returns a specific set of entries. By default this is 25 and ties into WEB_EVENTS_PER_PAGE in the ZM options menu.

0rsa avatar Jan 14 '21 16:01 0rsa

The doc is dated then. https://github.com/ZoneMinder/zoneminder/blob/master/web/api/app/Controller/EventsController.php#L77

pliablepixels avatar Jan 15 '21 02:01 pliablepixels

Ok thanks you. Maybe can you think about URL parameter to define items number per page? Currently I manage a double pagination.

0rsa avatar Jan 15 '21 02:01 0rsa

I actually don't like that we limit our results to 100. When we do, it should be considered an ERROR. Caller should specify a limit. We should deal with the issues around ram limits DOS etc...

connortechnology avatar Jan 15 '21 23:01 connortechnology

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 07:04 stale[bot]