Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

New GraphQL API and the Shopify Python Library?

Solved

New GraphQL API and the Shopify Python Library?

casadev
Visitor
1 0 0

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?

Accepted Solution (1)

Ashish_Shah
Shopify Staff
22 7 11

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

View solution in original post

Replies 3 (3)

Ashish_Shah
Shopify Staff
22 7 11

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

joephi
Tourist
3 1 0

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.

froystore
Shopify Partner
5 0 0

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.).