通过REST更新Magento 2中的产品描述



我正在通过REST API将产品数据导出到Magento 2商店。创建产品可以完美运行,但是当我更新现有产品时,descriptionshort_description不会更新。

数据:

{
  sku: 'LEDSL302',
  price: 7,
  name: 'LEDguardian®',
  attribute_set_id: 4,
  type_id: 'simple',
  custom_attributes: [
    { attribute_code: 'description', value: 'foo' },
    { attribute_code: 'short_description', value: 'bar' }
  ]
}

我错过了什么吗?

事实证明,由于某种原因,Magento使用的商店ID不一致。在请求 URL 中显式设置存储可修复此问题。

错误的网址:/index.php/rest/all/V1/products/

好网址:/index.php/rest/default/V1/products/

看? all应该在全球范围内影响产品,但没有奏效。选择默认(在我的情况下,仅)带有default的存储反而解决了问题。

最新更新