The error “Invalid external video url” suggests there is an issue with the externally hosted video, for example the URL may not bepublicly accessible. The [MediaUserErrorCode](https://shopify.dev/api/admin-graphql/2022-10/enums/MediaUserErrorCode) can shed more light in some cases as well.
I’d recommend trying something like the below to rule out any issues with formatting the mutation/variables:
mutation productCreateMedia($media: [CreateMediaInput!]!, $productId: ID!) {
productCreateMedia(media: $media, productId: $productId) {
media {
mediaContentType
... on ExternalVideo {
id
}
}
mediaUserErrors {
code
field
message
}
product {
id
}
}
}
{
"media": {
"alt": "Shopify Unite Tour 2022",
"mediaContentType": "EXTERNAL_VIDEO",
"originalSource": "https://youtu.be/9j4_22L_j3w"
},
"productId": "gid://shopify/Product/987654321"
}
now I found out that I can only reference external videos from YouTube or Vimeo,
The mutation productCreateMedia works if I reference a Youtube Video.
So far, so good.
However, what I want to achieve is to use the video that is hosted by Shopify within another product in another shop from where I copy the products. And I want to use the url shopify provides like https://cdn.shopify.com/videos/…
When using the productCreateMedia mutation, the CreateMediaInput.originalSource field should be an external URL or a staged upload URL. This means that if you pass a Shopify CDN hosted URL, it will not be accepted an “external URL” and expects the staged upload URL instead.
Since videos hosted on one Shopify store with a Shopify CDN URLs, are not meant to be used to create product media on other Shopify stores, it will likely need to be downloaded and restaged in the new store.