When using Shopware 6 /api/product REST-API I do get an timeout.
I found out i can set an limit and an offset.
When I call the API with /api/product?limit=240&offset=240 I still get the first 240 products.
Also tried using Shopware 5 offset variant, where you use start instead of offset.
Both give the same result.
I also tried doing an POST instead of an GET request, also no success.
I even using /api/search/product...
Does anyone know how to correctly perform an offset?
CodePudding user response:
In the shopware 6 API you can request paginated data by using limit
and page
parameters. The page
roughly translates to the offset that is being used, instead of doing a request with an offset of 240 (as in your example) you would request the page=2
with a limit of 240 this would give you the results 241-480.
So instead of
/api/product?limit=240&offset=240
you should use
/api/product?limit=240&page=2
The limit
and page
parameters can be used in GET-Requests, but also in POST-Request in the JSON-Body or in the search
endpoint.
Take a look at the official docs for reference.