如何在 shopware 6 的 API 的帮助下使用 productName 获取产品数据?

How to get product data using productName with the help of API in shopware 6?

我们可以使用哪种结构来获取产品数据使用API。

我尝试了以下过滤器,但得到了多个产品结果。

{  "search": {
"products": {
    "limit": 1,
    "filter": [
        { "type": "equals", "field": "productNumber", "value": "test_sku" }
    ],
    "sort": [
        { "field": "name", "order": "ASC" }    
    ]
}  }}

提前谢谢你..

要按产品编号搜索产品,您可以使用管理 API 或商店 API:

管理员API:POST /api/search/product

商店API:POST /store-api/product

两者的过滤内容相同:

{
    "filter": [
        {
            "type": "equals",
            "field": "productNumber",
            "value": "test_sku"
        }
    ]
}