Magento 2.2.7 REST API发布图像失败并显示500

时间:2018-12-12 16:43:19

标签: rest api post magento2

很长一段时间以来,我一直在使用Magento 2.1.11 Web API将图像上传到我的网站,并且一切正常。我升级到Magento 2.2.7,现在当我尝试相同的POST请求时出现500个内部服务器错误。有谁知道为什么会这样?也许服务器上的某些权限已更改?我正在努力在Google上找到任何东西。以下是我一直在使用的请求。

POST {{URL}} / rest / all / V1 / products / {{SKU}} / media

{
  "entry": {
    "media_type": "image",
    "label": "testImage",
    "position":1,
    "disabled": false,
    "types": [
      "image"
    ],
    "file": "testFile",
    "content": {
      "base64_encoded_data": "base 64 encoded string of image",
      "type": "image/jpeg",
      "name": "testName.jpg"
    }
  }
}

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

只需在Magento 2.2.7上进行测试。它对我有用:

enter image description here

您可以将模式设置为开发人员并将错误发送给我吗?或者,您可以在var / log / system.log

上检查错误

您可以使用此命令设置开发人员模式:

php bin/magento d:m:set developer