谁能帮我使用 REST API 显示类别及其子类别?
我试过这个网址:
http://localhost/magento/api/rest/products/:productId/categories
但它显示类别 ID 而不是我需要的,即像这样的东西:
http://localhost/magento/api/rest/categories
提前致谢。
最佳答案
/api/rest/products/:productId/categories
这应该检索分配给特定产品的类别列表。不幸的是,这不会引导您找到您应得的优雅解决方案。
如果您想要一个类别列表,您可能必须使用 soap api 来使用 catalog_categories.tree method 检索类别.我意识到“使用其他一些 api”是最糟糕的答案,但它是 Magento 目前提供的。
另一种方法是使用您自己的 restful 拼凑来扩展 stock api,但是,生命是短暂的。
如果您真的想做那样的事情,那么另一个 Stack Overflow 问题将帮助您入门: Create new magento Rest api to get category list in magento
关于php - 使用 REST API 在 Magento 中显示类别及其子类别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19557684/