Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用api在akeneo api中添加产品时出现问题_Php_Symfony_Akeneo - Fatal编程技术网

Php 使用api在akeneo api中添加产品时出现问题

Php 使用api在akeneo api中添加产品时出现问题,php,symfony,akeneo,Php,Symfony,Akeneo,我需要帮助在akeneo产品api usi api调用中创建产品。 当我在该api中添加产品时,它总是给出错误“此值不应为空”。我已经更改了文档中给出的所有参数,但没有结果 parameters { "identifier": "AT-TN-136-B-NCAL", "enabled": true, "family": "camcorders", "categories": [ "master" ], "groups": [],

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

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

尝试将akeneo api与Postman一起使用,以查看api的输入和输出

链接到api文档=>

下面是我通过postman获得的一个示例,它可能会让您更好地了解api产品帖子的外观

{
  "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"
      ]
    }
  }
}