Shopify REST and GraphQL API's - Clarification

Good morning,

I decided to just use the remix template and to learn React to get started. I don’t know enough about the Shopify ecosystem to build a Python Flask App or even a Node Express.js App from the ground up. That being said, I am understanding more about the different API approaches. I am using Remix now, and that being said…is the following an accurate assumption between the REST API and the GraphQL API?

Shopify Admin API1. Purpose: The Admin API is used for managing various aspects of a Shopify store, including products, orders, customers, and more.

  1. REST vs. GraphQL:

    • REST: The REST interface of the Admin API involves distinct endpoints for different resources (like /products, /orders, etc.). It’s suitable for straightforward, isolated requests.
    • GraphQL: The GraphQL interface allows for more complex queries with a single request. You can specify exactly which data you need, potentially reducing the amount of data transferred and simplifying data aggregation from multiple sources.
  2. Choosing REST or GraphQL:

    • For fetching product information, especially if you need specific fields or to aggregate data from different parts of the store, the GraphQL interface can be more efficient and flexible.
    • If your needs are simple and align with the predefined structure of the REST API endpoints, then REST could be sufficient.

So if I am trying to query locations, variants, orders, items and products…I am understand these all have their respective relationships between various ID’s. If the relationships are all connected in some regard, will GraphQL simplify my querying process? As opposed to creating my own logic to connect these endpoints relationally?

Thanks!

James

Hi James,

What you’ve said above is broadly correct, in that GraphQL is a more efficient way to make precise queries and mutations, and should in general simplify scenarios which would be more complex if you were attempting the same actions via REST. In addition, there are more endpoints and functionality available with GraphQL (for example the Storefront API and Metaobjects) which are not exposed in REST, which is another reason to choose using GraphQL for building a Shopify app. It’s possible that with a simple app, that is not currently making any complex queries, REST might be sufficient - but if this app evolves it could begin hitting up against the limits of REST, especially if you’re hoping to adopt new functionality that isn’t yet available in todays API. In my opinion, the best way to future-proof your app, and build it for scale, would be to start off using the GraphQL API.