7

Has anyone successfully uploaded an image for use with a category? When going through the documentation @ http://devdocs.magento.com/swagger/index.html#/ I don't see any implementation that could support it.

Also when retrieving a category using REST you don't get the category image back.

In the admin page, you can add the category here: enter image description here

6
+50

At the moment this is not possible without extending core functionality. However, category image save/get support can be added to category REST API using extension attributes mechanism:

  1. Declare extension attribute of string type for \Magento\Catalog\Api\Data\CategoryInterface (it will hold base64-encoded image)
  2. Write afterSave plugin for \Magento\Catalog\Api\CategoryRepositoryInterface::save to save image
  3. Write afterLoad plugin for \Magento\Catalog\Api\CategoryRepositoryInterface::get to load image

See more detailed instructions on declaring extension attributes in this answer

  • Thanks, that will probably do the job but I don't have that much knowledge to write a PR. I guess I'm left without the functionality then. – emp Jan 12 '16 at 16:15
1

Unfortunately we only had capacity to do the catalog extension objects at the time and haven't gotten to this yet. It would be great if someone can send in a PR.

Thanks, Chuck

  • I would like that too... upvoted! – emp Jan 12 '16 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.