Migrating ProductImage ids to Media ids

We are in the process of migrating to the GraphQL Admin API but we are running into an issue with product images. The image ids we have stored for our customers are ProductImage ids. With the new Media objects, the ids are different. We need to map our existing images to the new Media ids but I do not see any way to do that as we do not store Shopify’s URLs on our side. I compared the ids found in product.media.preview.image.id but those ids are ImageSource ids and also do not match the ids for the ProductImage from the REST API. Is there any way we can map the old ids to the new ids using the GraphQl API? Any guidance on this is much appreciated.

1 Like

Hi Derek, does anything in this just-published article help? (I’m not super familiar with this topic, but if you add questions or feedback here, will share back with the team):
https://shopify.dev/docs/apps/build/graphql/migrate/new-files-model

Hey Kim, thanks for the response. That article mentions that in the 2025-01 api version the MediaImage id will be included in the image payload from the REST API. That will definitely be helpful in the migration if we need to go that route. However, since the REST API is being retired it would be better if there was a way to map those ids using the GraphQL api (i.e. a way to query for a MediaImage id using a ProductImage id). This way we could update the ids on our side on an as-needed basis and we would not need to preemptively run a mass migration of all the image data we have stored in our databases before the the REST API is fully retired. Is there any chance something like that is, or will be, available?

1 Like

Including the ProductImage id in the MediaImage payload on a product would also be enough to solve the problem. So essentially the same thing that will be released on the REST API in 2025-01 but in reverse on the GraphQL API instead. That would be very helpful.