zfcampus / zf-apigility

BSD 3-Clause "New" or "Revised" License
258 stars 52 forks source link

Link URis are mallformed when quried with "pagesize" parameter #186

Open Channad opened 7 years ago

Channad commented 7 years ago

The "_links" list of the GET method called with "page_size" parameter seems to be malformed as shown in output below. The paginator does not seem to be supporting the provided "Page Size" dynamic page size parameter properly. The URL which produced the output is;

http://localhost:8080/agri_equipment?listOnly=1

{ "_links": { "self": { "href": "http://localhost:8080/agri_equipment?page=1" }, "first": { "href": "http://localhost:8080/agri_equipment" }, "last": { "href": "http://localhost:8080/agri_equipment?page=3" }, "next": { "href": "http://localhost:8080/agri_equipment?page=2" } }, "_embedded": { "agri_equipment": [ { "equipmentId": "1", "equipmentDesc": "Plough", "remarks": "A manually operated Plough to be used to prepare paddy fields", "created_on": "2017-03-11 00:00:00", "created_by": "1", "modified_on": "0000-00-00 00:00:00", "modified_by": "0", "_links": { "self": { "href": "http://localhost:8080/agri_equipment/1" } } } ] }, "page_count": 3, "page_size": 1, "total_items": 3, "page": 1 }

If I use any of the URIs given in the "_Links" list for pagination I get the wrong data or following error due to lack of embedding the "listOnly" parameter in the URI. for ex. If I call URI for next,

http://localhost:8080/agri_equipment?page=2

I get;

{ "type": "http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html", "title": "Conflict", "status": 409, "detail": "Invalid page provided" }

However if I modify it to be as; http://localhost:8080/agri_equipment?page=2&listOnly=1 then it works.

Hope this will help you guys to improve it.

weierophinney commented 4 years ago

This repository has been closed and moved to laminas-api-tools/api-tools; a new issue has been opened at https://github.com/laminas-api-tools/api-tools/issues/9.