How to specify an existing ItemId While uploading Media Items to Sitecore XM Cloud using UploadMedia mutation?

34 views Asked by At

We are migrating content and media library items from Sitecore 9.3 to Sitecore XM Cloud.

In this context, we are able to export all the existing media library items from Sitecore 9.3 to disk, along with other information like the existing item's ItemId and Alt Text.

While importing these media library items into Sitecore XM Cloud, we need to retain the same ItemId for these items, as otherwise, the content migration that is linked to these media library items in Sitecore 9.3 will break when we migrate the content to Sitecore XM Cloud, if the ItemIds for the imported media library items are different from what we have/had in Sitecore 9.3.

We cannot use powershell script to do the import into XM Cloud, as we don't have file system access on XM Cloud to be able to upload the media library files separately and do this in PowerShell using Sitecore Powershell ISE.

So the only option we found was to use XM Cloud's Graph QL API.

We are using the uploadMedia mutation.

enter image description here

As you can see, the uploadMediaInput parameter does not have a property to set an existingItemId / desiredItemId.

When we execute this endpoint, the media library items gets uploaded to XM Cloud fine, but it has a new / different ItemId.

So question is, how can I upload a Media Library items to Sitecore XM Cloud using the Graph QL API and have it create the item with an ItemId that I want.

0

There are 0 answers