Glue API pagination offset bug


#1

Hi there,

we’re currently experiencing a bug with the API pagination.

It uses a limit and an offset parameter to

  • define the max. number of returned records
  • define the skipped number of records

This is also what the links for a paginated resource imply:
“links”: {
“self”: “http://glue.de.suite.local/orders?page[limit]=3&page[offset]=1”,
“last”: “http://glue.de.suite.local/orders?page[offset]=12&page[limit]=3”,
“first”: “http://glue.de.suite.local/orders?page[offset]=0&page[limit]=3”,
“prev”: “http://glue.de.suite.local/orders?page[offset]=0&page[limit]=3”,
“next”: “http://glue.de.suite.local/orders?page[offset]=4&page[limit]=3
}

At least for the /orders endpoint, pagination does not work as expected.
The offset value is actually used as a page number.
Because of that, page[limit]=3&page[offset]=1 actually skips 3 entries, not 1.

EDIT:
I’ve collected some more information on this bug.
Problem is, that the sales module uses propel’s pagination feature to return the requested orders.
This feature does support an offset, but works with actual pages.

\Spryker\Glue\OrdersRestApi\Processor\Order\OrderReader::getOrderListAttributes simply sets the given offset value as the page number.

Can you please check this bug?


#2

Hi Felix,

Thank you for the report. I’ve created an internal ticket for this. I’ll notify here about further updates.

Best regards,
Valerii