I’ve been reading about the new GraphQL API and I’m not quite sure what that means for Shopify’s Python API. According to the GitHub repository, it relies heavily on the pyactiveresource library, which maps to the REST webservices resources. Should my custom app be migrated or what am I expected to do now?
Topic summary
The discussion centers on how Shopify’s new GraphQL API affects the existing Python library, which currently relies heavily on REST webservice resources.
Key Concerns:
- The original Python library uses REST wrappers and the pyactiveresource library
- Users are uncertain whether custom apps need migration to GraphQL
Official Response:
- REST wrappers will no longer be supported
- Developers must transition to using the GraphQL client available in the Shopify Python API repository
Community Workarounds:
- One user inquired about plans to migrate REST wrappers to GraphQL, noting the convenience of methods like
shopify.Product.find(ID)andproduct.title = TITLEfor readability - Another developer created custom classes that emulate REST Admin wrappers to simplify interaction with GraphQL objects
- These custom classes help avoid repeatedly typing/copying string fields for common objects (product, productVariant, metafield, etc.)
Status: The discussion remains open with no official migration timeline provided for REST-style wrappers.
Hello @casadev
You will no longer be able to use the REST wrappers. You will have to use the GQL client: https://github.com/Shopify/shopify_python_api?tab=readme-ov-file#graphql
Are there plans to migrate the REST wrappers to GQL? Being able to use shopify.Product.find(ID), product.title = TITLE, etc. is extremely helpful and significantly improves readability as opposed to the queries that’ll span many lines.
Of course I don’t expect this to happen immediately, I’m just curious if there are plans to migrate.
We just went ahead and created custom classes that emulate the REST Admin wrappers so that we can at least interact with GQL objects more easily. Having to type or copy/paste string fields each time when you define a new method/function is very tiresome and error-prone.
Create these classes for common objects that you frequently interact with (product, productVariant, metafield, etc.).