Magento2: Adding images via REST API gives error "Property \"EntryId\" does not have corresponding setter in class

Created on 24 Feb 2016  路  3Comments  路  Source: magento/magento2

Magento 2.0.1 + sample data

PUT rest/V1/products/test4/media/2

Data used:
{
"entry":{
"entryId":"2",
"media_type": "image",
"label": "Test",
"position": 1,
"disabled": false,
"types": ["image"],
"content":{
"base64_encoded_data":"/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAkACQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD9/K5n4t/Grwb8APBc3iTx54s8M+CfDtvIkMuqa9qkGm2UTudqK00zKgZjwATkngV01eC/8FBf2yPhn+wx8K9H8cfEL+w5NRXVl0/wjBqE9taNcatPDLGiR3VwViswYmmElxI6JHEZNzYO1oqS5Vf0873drJdW9ku9tyoxu7ev5bvslu32PZPA3jzQ/if4P07xD4Z1nSfEWgaxAt1Yanpl3Hd2d7E3KyRSxko6Hsykg1rV86f8Er9G8K+H/wBj3TLfwr488DfEVbjV9U1XWNT8H6rDqWiwapf3s2oXdrbSREqIoZLooinD7AjMAzGvoutqkeWVv6+/r69dzOElJXW2vl17dPNdNugUUUVBQUUUUAFFFFABRRRQAUUUUAFFFFABRRRQB//Z",
"type":"image/jpeg",
"name":"test.jpg"
}
}
}
Output Error:

{"message":"Property \"EntryId\" does not have corresponding setter in class \"Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface\".","trace":"#0 \/data\/web\/magento2\/vendor\/magento\/framework\/Reflection\/TypeProcessor.php(591): Magento\Framework\Reflection\TypeProcessor->findAccessorMethodName(Object(Zend\Code\Reflection\ClassReflection), 'EntryId', 'getEntryId', 'isEntryId')\n#1 \/data\/web\/magento2\/vendor\/magento\/framework\/Webapi\/ServiceInputProcessor.php(138): Magento\Framework\Reflection\TypeProcessor->findGetterMethodName(Object(Zend\Code\Reflection\ClassReflection), 'EntryId')\n#2 \/data\/web\/magento2\/vendor\/magento\/framework\/Webapi\/ServiceInputProcessor.php(262): Magento\Framework\Webapi\ServiceInputProcessor->_createFromArray('Magento\Catalog...', Array)\n#3 \/data\/web\/magento2\/vendor\/magento\/framework\/Webapi\/ServiceInputProcessor.php(99): Magento\Framework\Webapi\ServiceInputProcessor->convertValue(Array, 'Magento\Catalog...')\n#4 \/data\/web\/magento2\/vendor\/magento\/module-webapi\/Controller\/Rest.php(262): Magento\Framework\Webapi\ServiceInputProcessor->process('Magento\Catalog...', 'update', Array)\n#5 \/data\/web\/magento2\/vendor\/magento\/module-webapi\/Controller\/Rest.php(160): Magento\Webapi\Controller\Rest->processApiRequest()\n#6 \/data\/web\/magento2\/var\/generation\/Magento\/Webapi\/Controller\/Rest\/Interceptor.php(24): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))\n#7 \/data\/web\/magento2\/vendor\/magento\/framework\/App\/Http.php(115): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#8 \/data\/web\/magento2\/vendor\/magento\/framework\/App\/Bootstrap.php(258): Magento\Framework\App\Http->launch()\n#9 \/data\/web\/magento2\/pub\/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))\n#10 {main}"}

Is it possible to send image not via base64_encoded_data? Is so, let us know, in what way.

Please, help us.
Thanks in advance

All 3 comments

@MomotenkoNatalia , @kandy , I am also facing same issue while adding images to already existing item on Magento 2, is there any update on it? Also is there any API to upload images on Magento2 so I can link it later to existing items?

@kandy , @MomotenkoNatalia , is there any update ?

I'm closing this issue as GitHub issue tracker is intended for technical issues only. Please refer to the Community Forums or the Magento Stack Exchange site for technical questions.
If you think it to be an issue which requires fix please create new GitHub issue following the Issue reporting guidelines: with steps to reproduce, actual result and expected result. Please, also identify which version of Magento you are running.

Was this page helpful?
0 / 5 - 0 ratings