I have some youtube video urls and the matching products. How can I add the videos to the media galleries of my products, as it would be added when I do this via the backend?
I tried using the class ProductAttributeMediaGalleryManagement
, but I would have to set a content
value that is validated in the create method, but I have no idea to what value this should be set. I also tried to create the Entry and the VideoEntry over factories, but there I have to set a image file, otherwise I also get an exception. I don't have an image file, if I add the video via Backend it creates some placeholder image.
I just want the same behavior as when I go to the backend click Add Video
, input URL, Title and Description and click Save.
Best Answer
this seems to be a bug in the Api.
Looking at the Rest Api Documentation of the
catalogProductAttributeMediaGalleryManagementV1
Resource, the Image Content seems to be required while the Video content is optional:http://devdocs.magento.com/swagger/index.html