Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zones.json doesn't support pagination #1537

Closed
earlymeadow opened this issue Jun 17, 2016 · 2 comments
Closed

Zones.json doesn't support pagination #1537

earlymeadow opened this issue Jun 17, 2016 · 2 comments
Labels
Web API REST API

Comments

@earlymeadow
Copy link

If I curl http://server/zm/api/zones.json it appears to return a list of all available zones. Now that I've been adding and deleting zones, I noticed that only 20 zones are returned, whilst I have a few more.

I don't see any pagination item, so there's no way to tell if there are more zones. Also, http://server/zm/api/zones.json?page=1 does nothing more that return the same 20 zones.

I am able to get the neccessary zone info by getting http://server/zm/api/zones/44.json, but seeing as deleting zones leaves holes in the zone numbering (zid), I have no way of knowing when to stop "getting zones" one by one.

I know I'm using an undocumented API feature, but it would save me a lot of unneccessary calls if it would work as suspected ;).

Am I doing something horribly wrong, or is this a bug?

(using 1.29 cent os 7) (also posted in forum https://forums.zoneminder.com/viewtopic.php?f=34&t=24953)

@pliablepixels
Copy link
Member

The short answer is its likely a bug. I am fixing/extending APIs using zmNinja as the client. So features that zmNinja don't support mostly don't get tested by me. I'll look at the zones API in a few weeks - chances are everything you are saying is correct and there are bugs.

@SteveGilvarry SteveGilvarry added the Web API REST API label Jul 27, 2016
@pliablepixels
Copy link
Member

pliablepixels commented Sep 3, 2016

I've just started looking at zones APIs. If it helps, to get all the zones for a specific monitor, use https://server/zm/api/zones/forMonitor/X.json. You already have an API to get all monitors.

I've also figured out the core issue (I think). ZonesController doesn't have an index method with pagination added. I'm not an expert at cake, but I've noticed APIs that don't have index seem to have some form of default implementation that doesn't do what we expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Web API REST API
Projects
None yet
Development

No branches or pull requests

3 participants