2

我需要帮助在 akeneo 产品 api usi api 调用中创建产品。当我在该 api 中添加产品时,它总是给出错误“此值不应为空。” 我已经更改了文档中给出的所有参数,但没有结果

parameters {
    "identifier": "AT-TN-136-B-NCAL",
    "enabled": true,
    "family": "camcorders",
    "categories": [
        "master"
    ],
    "groups": [],
    "parent": null,
    "values": {},
    "associations": {}
}

result
{
    "code": 422,
    "message": "Validation failed.",
    "errors": [
        {
            "property": "identifier",
            "message": "This value should not be blank."
        }
    ]
}
4

1 回答 1

0

您的参数中可能缺少一个键:值对。

尝试使用带有 Postman 的 akeneo api 来查看 api 的输入和输出。

链接到 api 文档 => https://api.akeneo.com/getting-started/your-first-tutorial-4x/welcome.html

这是我通过邮递员采取的示例,它可能会让您更好地了解 api Product Post 的外观。

{
  "identifier": "new_product",
  "family": "tshirts",
  "groups": [],
  "parent": null,
  "categories": [
    "tvs_projectors"
  ],
  "enabled": true,
  "values": {
    "clothing_size": [
      {
        "locale": null,
        "scope": null,
        "data": "s"
      }
    ],
    "description": [
      {
        "locale": "en_US",
        "scope": "mobile",
        "data": "Akeneo T-Shirt"
      },
      {
        "locale": "en_US",
        "scope": "print",
        "data": "Akeneo T-Shirt with short sleeve"
      }
    ],
    "main_color": [
      {
        "locale": null,
        "scope": null,
        "data": "black"
      }
    ],
    "name": [
      {
        "locale": null,
        "scope": null,
        "data": "Akeneo T-Shirt black and purple with short sleeve"
      }
    ],
    "secondary_color": [
      {
        "locale": null,
        "scope": null,
        "data": "purple"
      }
    ],
    "tshirt_materials": [
      {
        "locale": null,
        "scope": null,
        "data": "cotton"
      }
    ],
    "tshirt_style": [
      {
        "locale": null,
        "scope": null,
        "data": [
          "crewneck",
          "short_sleeve"
        ]
      }
    ],
    "price": [
      {
        "locale": null,
        "scope": null,
        "data": [
          {
            "amount": 10,
            "currency": "EUR"
          },
          {
            "amount": 14,
            "currency": "USD"
          }
        ]
      }
    ]
  },
  "created": "2017-03-30T14:55:26+02:00",
  "updated": "2017-05-04T23:56:09+02:00",
  "associations": {
    "SUBSTITUTION": {
      "groups": [],
      "products": [
        "AKNSTK"
      ]
    }
  }
}
于 2020-06-30T13:24:59.823 回答