【问题标题】:Get Product List with more details in Magento2 API在 Magento2 API 中获取更多详细信息的产品列表
【发布时间】:2018-05-16 10:56:15
【问题描述】:

我正在开发一个原生应用程序,需要根据类别获取产品列表。

就像当用户点击一个类别时,我必须显示该类别内的产品列表。

我尝试了一项服务,但它只提供三个字段作为回报

    http://www.dexample.com/index.php/rest/V1/categories/1680/products

回复

{
    "sku": "FB-Bridgewater",
    "position": 1,
    "category_id": "1680"
}

我需要更多信息,例如姓名、图片、价格等。

【问题讨论】:

    标签: json api magento2


    【解决方案1】:

    您可以使用搜索 API 来获取产品的更多信息。

    此 API 将为您提供包含详细信息的产品:

    http://www.dexample.com/index.php/rest/V1/products?
    searchCriteria[filter_groups][0][filters][0][field]=category_id&
    searchCriteria[filter_groups][0][filters][0][value]=1680&
    searchCriteria[filter_groups][0][filters][0][condition_type]=eq
    

    Magento2 的通用搜索 API 是

    searchCriteria[filter_groups][<index>][filters][<index>][field]=<field_name>
    searchCriteria[filter_groups][<index>][filters][<index>][value]=<search_value>
    searchCriteria[filter_groups][<index>][filters][<index>][condition_type]=<operator>
    

    地点:

    field 是一个属性名。

    value 指定要搜索的值。

    condition_type 指定条件[ex: eq , finset, like, from, to]

    【讨论】:

    • 您能否告诉我如何获取产品评论列表,以及我是否在产品中有多种选择,例如颜色,其中一种选择是收费的,例如红色改变额外的 5 美元,然后调用哪个 API 并更改产品的产品
    • 您可以通过sku获取特定产品的详细信息,例如:localhost/magento/index.php/rest/V1/products/sku
    • 是的,但我没有在该 API 中获得评论详细信息
    • 那么我可以在移动应用程序中显示产品评论
    猜你喜欢
    • 1970-01-01
    • 2013-04-19
    • 1970-01-01
    • 1970-01-01
    • 2016-08-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-01-23
    相关资源
    最近更新 更多