【问题标题】:problem adding products in akeneo api using API使用 API 在 akeneo api 中添加产品的问题
【发布时间】:2019-04-29 07:19:47
【问题描述】:

我需要帮助在 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."
        }
    ]
}

【问题讨论】:

    标签: php symfony akeneo


    【解决方案1】:

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

    尝试使用带有 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"
          ]
        }
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-02
      • 1970-01-01
      相关资源
      最近更新 更多