Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: write a guide on how to use ShopifySharp with the GraphQL API #1099

Open
nozzlegear opened this issue Oct 1, 2024 · 9 comments · May be fixed by #1126
Open

Documentation: write a guide on how to use ShopifySharp with the GraphQL API #1099

nozzlegear opened this issue Oct 1, 2024 · 9 comments · May be fixed by #1126

Comments

@nozzlegear
Copy link
Owner

Shopify has announced¹ that after April 2025, all new public apps submitted to the Shopify app store must use GraphQL, and the REST API will be deprecated. ShopifySharp does support the GraphQL API, but the documentation is extremely lacking. I'm updating the documentation for this right now, and will write a longer guide on building an app with ShopifySharp + GraphQL as well.

¹ https://shopify.dev/changelog/starting-april-2025-new-public-apps-submitted-to-shopify-app-store-must-use-graphql

@ThatBrianK
Copy link

Hi,
I'm looking forward to this documentation. I'm a little unclear on the direction things will be going in this development overall. Will we be able to use the existing ShopifySharp.Product and ProductService objects that will use an underlying GraphQL API call in the future? or will those be deprecated once we hit 2025-04 and we'll have to use the GraphQL objects directly?

@nozzlegear
Copy link
Owner Author

Hey @ThatBrianK! I'm planning to support the Rest API, and therefore the ProductService, for as long as Shopify themselves support it. New apps won't be able to use the Rest API after April 2025, and if I had to bet, I'd put my money on the Rest API being removed completely in April 2026 for existing apps.

I don't plan on deprecating ShopifySharp itself at any point though, since I still use it every day for my own Shopify apps and for my clients' apps. We'll have the same GraphService that we have right now, where you can write completely custom queries specialized for exactly the data that you need; and then perhaps (speculation here, I haven't finalized my plans) individual services like we have today such as a ProductService that just makes Graph API calls instead of Rest API calls.

@ThatBrianK
Copy link

Thanks for the update. I really feel the 6 month deadline looming ( I need to be able to support new clients), and I'm completely new to graphQL. I am going to try and document as best I can my process of converting my existing product/variant sync with the existing ProductService and ProductVariantService to queries written for graphQL, so that maybe it can be helpful to others in my situation. It's too bad it's so different, as the primary reason for me using ShopifySharp was how easy it made working with products and variants as all the fine details were taken care of.
Thanks again for all your work on this project and hopefully I can make my own contribution eventually!0

@jbyte2009
Copy link

Yes. This would be great.

@contech-ernst-meinhart
Copy link

contech-ernst-meinhart commented Jan 2, 2025

@nozzlegear finalization of your plans regarding this would be very appreciated.
As for my case i currently build a new shopify integration and only by coincidence when researching for other issues i found this topic here. I´ve assumed that this integration is using the GraphQL anyway out of the box and started implementing.

Now i know, that i should better use the GraphQL service as i don´t want to change the integration anytime soon. In my opinion this topic should be noticable highlighted in README when visiting the this repo to avoid probably many frustration when somebody is not aware that this integration is using the REST API by default.

Also as on Shopify docs the deprecation of REST API is so present that i would never think that any maintained Sdk would still use this Api anymore.

@nozzlegear
Copy link
Owner Author

Hey @contech-ernst-meinhart, thanks for bringing this up! I've been actively working on #1051 for the last month or so, which has been my main blocker for moving forward with any other GraphQL improvements, including documentation; I wanted to start off with a solid foundation.

That said, over the last couple days I've been actively cleaning up the commits in that PR and splitting them into smaller PRs. It will be merged today, along with documentation on how to use the GraphService.

After that, I'm going to begin writing a more in-depth guide on using Shopify's GraphQL API with the GraphService. It'll probably be something along the lines of "how to create, update and manage products using ShopifySharp and Shopify's GraphQL API" since that's a popular topic.

Following that, I have two plans:

  1. Begin implementing Feature: Generate methods based on .graphql files #1072
  2. Explore repurposing the various REST API services (e.g. ProductService, OrderService) and filling them out with Shopify's GraphQL queries and mutations. So instead of ProductService.ListAsync and ProductService.UpdateAsync using the REST API endpoints, it might use the GraphQL products(first: ...) { ... } query and productUpdate(product: ...) { } mutation.

Let me know what you think!

@nozzlegear
Copy link
Owner Author

Also as on Shopify docs the deprecation of REST API is so present that i would never think that any maintained Sdk would still use this Api anymore.

I missed this part. The situation has been a bit confusing, but the REST API is still "allowed" for any app that's already been approved and published on the app store, and for any custom app that was created before a certain date. That's why ShopifySharp still supports the REST API: Shopify has certainly deprecated it, but it's not dead yet and existing apps can still use it for at least another six months.

You're right about the documentation though; the fact that new apps must use the GraphService really needs to be called out.

@clement911
Copy link
Collaborator

Hi @nozzlegear

I understand that you have been working on some significant changes in a separate branch.
That's great. I love that you keep investing in the project.

I haven't had a look into the specific changes yet.
That being said, I wanted to chime in regarding the potential scope creep of the project.
I personally believe that we should keep a very simple and thin core.

I understand that you are exploring generating method based on .graphql files and also 'repurposing the various REST API services and filling them out with Shopify's GraphQL queries and mutations'.

Are you planning on creating separate nuget packages for those?

I'm not sure that hard coding graphql queries in the project is a good idea. They have been quite aggressive in deprecating fields and changing the API. Hard coding queries might cause some maintenance headaches down the line.

@nozzlegear
Copy link
Owner Author

Thanks @clement911! I'm wary of scope creep too — I've built up a list of interesting ideas that I've wanted to explore while working with clients over the last year, and a lot of it revolves around dev tooling in this space. I'm going to try to be careful not to bloat the base ShopifySharp package itself with stuff that doesn't belong.

I think secondary Nuget packages will be the best fit for some of the stuff I've been talking about for sure. For #1072 in particular, I don't see that being included in ShopifySharp itself but rather something like "ShopifySharp.Graph.Generator" (just off the top of my head). I could also see the hardcoded queries/mutations services going into its own Nuget package as well, since it'd be likely to get frequent updates as you said. In that scenario, ShopifySharp could continue along at its somewhat slower release cadence, with the base GraphService and the generated GraphQL classes.

As always, I'm open to feedback on this stuff! I'll open up an issue for more discussion on those two packages I talked about soon.

@nozzlegear nozzlegear moved this from Todo to In Progress in ShopifySharp GraphQL improvements Jan 3, 2025
@nozzlegear nozzlegear pinned this issue Jan 3, 2025
@nozzlegear nozzlegear linked a pull request Jan 7, 2025 that will close this issue
9 tasks
@nozzlegear nozzlegear added this to the 6.23.0 milestone Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

5 participants