Migrate your app to use non-encoded object IDs
In API version 2022-04, using Base64-encoded object IDs as arguments to fields and mutations was deprecated. Support for this behavior will be removed in API version 2023-07.
This guide shows you to migrate your app from using Base64-encoded object IDs to non-encoded object IDs.
Requirements
Anchor link to section titled "Requirements"You need to migrate your app if you're caching or parsing IDs, or persisting IDs to a database.
If your app queries the Storefront API and uses the object IDs as they're given without any long-term persistence or transformations, then you don't have to migrate your app.
Step 1: Migrate your app
Anchor link to section titled "Step 1: Migrate your app"Most object types in Shopify's GraphQL APIs have an id
field. The id
field represents the globally-unique identifier for an individual record. The following are examples of a product ID in the GraphQL Admin and Storefront APIs before the change:
To help you migrate your app, Shopify has changed the GraphQL Storefront API to allow for non-encoded object IDs to be used interchangeably as arguments to fields and mutations. For example, the following two queries are now valid and return identical responses:
Step 2: Handle persisted IDs
Anchor link to section titled "Step 2: Handle persisted IDs"If you have a database of persisted object IDs, then there are a few possible migration strategies.
Base64 encoding and decoding is commonly a part of most programming standard libraries, and if not, readily available as a 3rd-party package. You can write a script that iterates through each record, removes the Base64 encoding, and updates the database. The following example shows what a script written in Ruby could look like:
- If you have questions or need help migrating your app, refer to Shopify's Storefront API Feedback GitHub discussion board.