Shopware 6产品API限制和偏移

发布于 2025-01-29 04:25:00 字数 272 浏览 4 评论 0原文

使用Shopware 6 /api /product rest-api时,我确实会暂停。
我发现我可以设置限制和偏移。
当我用 /api /product调用API时?limit = 240& offset = 240我仍然得到第一个240个产品。
还尝试使用Shopware 5偏移量,您可以在其中使用启动而不是偏移。
两者都给出相同的结果。
我还尝试执行帖子而不是get请求,也没有成功。
我什至使用/api/搜索/产品...

有人知道如何正确执行偏移吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

裸钻 2025-02-05 04:25:00

在Shopware 6 API中,您可以使用limitpage参数请求分页数据。 page大致转化为正在使用的偏移,而不是使用240的偏移(如示例)进行偏移请求,而是请求page = 2带有限制为240,这将为您带来241-480的结果。

因此,

/api/product?limit=240&offset=240

您不应该使用

/api/product?limit=240&page=2

limitpage参数可以在get-requrequests中使用,但也可以在JSON-BODY或> 中使用。搜索端点。

看看文档供参考。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文