I'm trying to create a web service rest to add an image to category, but I can't find the Model method that allow to do this.
I'm looking for something like
addImage of Magento\Catalog\Model\Product\Gallery\Processor
for the category.
Thanks
For category, by default, seem that we cannot do the same, however, we can add the image like this:
/** @var \Magento\Catalog\Model\Category $category **/
$category->isObjectNew(true);
$category->setId(5)
->setName('Category 1.1.1')
->setParentId(4)
->setPath('1/2/3/4/5')
->setLevel(4)
->setAvailableSortBy('name')
->setDefaultSortBy('name')
->setIsActive(true)
->setPosition(1)
->setCustomUseParentSettings(0)
->setCustomDesign('Magento/blank')
->setThumbnail('media/catalog/category/test.jpg')
->save();
With API (not yet test)
/** @var \Magento\Catalog\Api\CategoryRepositoryInterface $category **/
$category->get($categoryId)
->setThumbnail('media/catalog/category/test.jpg');
->save();