How to return paginated resource response for rest api service in zf2

How to generate paginated responses for rest API via getList method.

Hey @Shalaka_Deshan,

welcome to the Laminas forums.

This depends how your service is configured. If the content negotiation setting is set to hal/json a pagination is fully implemented in all collection requests. In detail it 's the fetchAll method of your resource. If content negotiation is set to json a pagination is not included at all. You have to write your own json view plugin to provide pagination data with a simple json collection response.

I 'd recommend to use the build in hal/json solution.