OK, I have some bundled product to create and I want to do it programatically.

Problem is, I want to add (to MediaGallery) some videos, as it can be done in case of images. It can be done via adminhtml product edit form and works like a charm. So far I have found module-product-video in vendor. I'm not sure if that's it.

I think maybe I should use then VideoEntryFactory and bind it with product instance but I am not sure. In Model of Product i haven't found method similar to addImageToMediaGallery.

If anyone have faced it, please give me some advices.

  • Do anyone explored module ProductVideo? Maybe that's the clue? Commented Jun 2, 2016 at 6:54
  • The best would be video is provided as file not as url. Commented Jun 17, 2016 at 17:40
  • Did you found a solution with or without using REST API ?
    – spiilmusic
    Commented May 9, 2017 at 7:41
  • Actually I have added new extension attribute - similar and based on downloadable samples (they are available with downloadable products) to other type of product in needed (in my case bundle), because it seems to me much more flexible than some vimeo/YT videos. Only thing - if you do it like this videos will appear not in media gallery, but in separate blocks. It required not so much coding, if you use inheritance by downloadable samples ui components clasess (but COMPOSITION is prefered over INHERITANCE, so it is not best solution). Commented May 9, 2017 at 8:21

2 Answers 2


you can use the rest api POST /V1/products/{sku}/media

  "entry": {
    "id": 0,
    "mediaType": "string",
    "label": "string",
    "position": 0,
    "disabled": true,
    "types": [
    "extensionAttributes": {
      "videoContent": {
        "mediaType": "string",
        "videoProvider": "string",
        "videoUrl": "string",
        "videoTitle": "string",
        "videoDescription": "string",
        "videoMetadata": "string"
  • ok, thank you I will check it on monday :) Commented Jun 18, 2016 at 8:25
  • 1
    I have no expirience with REST Api, can add some more explantation how it can be done or some example where to put content you have uploaded above? Commented Jun 21, 2016 at 13:23
  • is there a way to do it programmatically using some models etc Commented Nov 5, 2017 at 4:36

To use the rest API, you need to first authenticate ( can be done trough PHP ) with either a token or an OAuth, once authenticated you basically put the authentication token in your header, together with the format ( json ) and then you call the URL you want, choose if it's POST or GET, put the data you want to parse into an array, encode it do JSON and put the json into the header. More info about the REST API mehthods here : http://devdocs.magento.com/swagger/index.html, and more detailed info of how to get auth. with rest calls here : http://devdocs.magento.com/guides/v2.0/get-started/authentication/gs-authentication-token.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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