Discuss all the new features introduced with the new product model in GraphQL.
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?
Solved! Go to the solution
This is an accepted solution.
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
ALIAS | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
This is an accepted solution.
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
ALIAS | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
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.).