cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a Vimeo video to the product media gallery through the REST API

How to add a Vimeo video to the product media gallery through the REST API

Hi!


I'm trying to add a Vimeo video to the product media gallery through the REST API.

 

When I made the call to /V1/products/{sku}/media with a valid sku and this payload

 

{
  "entry": {
    "mediaType": "external-video",
    "label": "39-1462396048639-1",
    "disabled": false,
    "types": [
      "thumbnail",
      "small_image",
      "image",
      "swatch_image"
    ],
    "extensionAttributes": {
      "videoContent": {
        "mediaType": "external-video",
        "videoUrl": "https ://api.vimeo.com/videos/16536035333229",
        "videoTitle": "39-1462396048639-1"
      }
    }
  }
}

I recieved this message

 

500: Internal Server Error

{"message":"Recoverable Error: Argument 1 passed to Magento\\Framework\\Api\\ImageContentValidator::isValid() must be an instance of Magento\\Framework\\Api\\Data\\ImageContentInterface, null given, called in /home/feriaganaderacom/public_html/vendor/magento/module-catalog/Model/Product/Gallery/GalleryManagement.php on line 69 and defined in /home/feriaganaderacom/public_html/vendor/magento/framework/Api/ImageContentValidator.php on line 50","trace":"#0 /home/feriaganaderacom/public_html/vendor/magento/framework/Api/ImageContentValidator.php(50): Magento\\Framework\\App\\ErrorHandler->handler(4096, 'Argument 1 pass...', '/home/feriagana...', 50, Array)\n#1 /home/feriaganaderacom/public_html/vendor/magento/module-catalog/Model/Product/Gallery/GalleryManagement.php(69): Magento\\Framework\\Api\\ImageContentValidator->isValid(NULL)\n#2 [internal function]: Magento\\Catalog\\Model\\Product\\Gallery\\GalleryManagement->create('39-cabezas-1462...', Object(Magento\\Catalog\\Model\\Product\\Gallery\\Entry))\n#3 /home/feriaganaderacom/public_html/vendor/magento/module-webapi/Controller/Rest.php(265): call_user_func_array(Array, Array)\n#4 /home/feriaganaderacom/public_html/vendor/magento/module-webapi/Controller/Rest.php(160): Magento\\Webapi\\Controller\\Rest->processApiRequest()\n#5 /home/feriaganaderacom/public_html/var/generation/Magento/Webapi/Controller/Rest/Interceptor.php(24): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#6 /home/feriaganaderacom/public_html/vendor/magento/framework/App/Http.php(115): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#7 /home/feriaganaderacom/public_html/vendor/magento/framework/App/Bootstrap.php(258): Magento\\Framework\\App\\Http->launch()\n#8 /home/feriaganaderacom/public_html/index.php(39): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http))\n#9 {main}"}


It seems that Magento is trying to process an image, but I'm only sending a video

What am I missing? Any idea

thanks

 

2 REPLIES 2

Re: How to add a Vimeo video to the product media gallery through the REST API

Hi Alan,

 

is there any solution to this?

 

We've postponed this feature in our product but now we need to implement it

 

Hope you can help us.

 

Thanks

Re: How to add a Vimeo video to the product media gallery through the REST API

Very sorry for delay - busy + been on extended leave. In general it is best to submit suspected bugs on GitHub. They then get directed at the appropriate engineers who know the lower level details. I agree that this one smells more like a bug from the error message you are getting.