How to get list of all categories from apigility for news page?

Guys! I am using Zend-MVC and apigility together. I have page of news with form where I edit news. I make “get” request to the url /api/rest/news/123 to get news (news id = 123) data from db. I have field category where I can choose some category for news. The question is: how to get list of all categories from apigility for news page?
fetchAll() method provide paginator result and not whole list of rows of table.
Also, I need that all categories on the page where I add news which means I don’t know id news which means I don’t do “get” request to the apigility url /api/rest/news/123
Should I use separate RPC method for getting all categories?
Also, I need once more field with list of categories with excluded categories from that list.

Why don’t you create a REST API for /api/rest/categories and return them this way?

I already have REST API for /api/rest/categories with paginator.

You could specify a pagesize parameter on the General settings tab of the categories REST endpoint, then whitelist the pagesize parameter (use the “Collection Query String Whitelist” facility on the same tab), then get all the categories out by setting the pagesize to “-1” in your GET request to that endpoint via the pagesize parameter

e.g. GET /api/rest/categories?pagesize=-1

1 Like

Yes, probably, this is exactly what I need. I will check it later. The same answer I’ve got in the zf chat.