Calix Community  
 

Activate API/NBI not showing all Nodes, Interfaces, Profiles, etc.

0
Started ‎03-02-2017 by
Modified ‎03-02-2017 by

The Activate API/NBI, both the ADPIDoc Swagger and the client interface, will by default only return 20 items. Those items can be lines, services, devices, etc.

 

So if i have 57 nodes and I do a GET for devices, it will only return 20 of them. What we need to do is use pagination. For pagination, what we do is specify a limit and an offset. For example, if pull all devices for the network above I listed (57 nodes).

GET https://IP:18443/rest/v1/config/device

In the response, it will give me 20 nodes but in the response header it will also say:

"x-total-count": "57",

This tells me there are 57 total items (of which i gave you the first 20). I now have 2 options, i can either pull all 57 all at once with:

https://IP:18443/rest/v1/config/device?limit=57

Above is good because 57 is very few, but what if i want to pull alarm history which will have thousands of lines?

https://IP:18443/rest/v1/fault/alarm-log
"x-total-count": "136767",

The answer is pagination. So in this case, I want to see 10 per "page" and we use the offset to define the page.

https://IP:18443/rest/v1/fault/alarm-log?offset=10&limit=10
https://IP:18443/rest/v1/fault/alarm-log?offset=20&limit=10

and you get the idea, 30, 40, etc.

 

In the APIDoc (Swagger) interface, you can hit the "Show Extra Optional Display Parameters" under the request and see the additional options.

 advanced.png

Comments
by Calix Employee
on ‎03-03-2017 12:51 AM - last edited on ‎03-03-2017 05:10 AM by Moderator Moderator

I have experienced a similar situation around alarm. Where the alarm count was
Sandbox: 6

Activate: 6

GET /fault/alarm: 5

 

However, after signing off and on from REST:4443. The count was 6.

 

I could not reproduce the issue.

 

Contributors