Issues with migrating to graphql bulk api

Highlighted
New Member
1 0 0
When migrating away from the old REST API pagination model to the new Graph API bulk operation, we have faced quite a few issues stopping us from migrating. We're mainly interested in the Products (and Variants), Orders, Customers and Collections entities.‌ The issues we had are as follows:
 
- There are fields missing in almost all the above entities when comparing to the old API. Almost all entities have missing fields when comparing to the rest api (we have a comparison list to provide).
 
- Some objects like OrderLine used to have an ID that we rely on, but there is no "legacyResourceId" available anymore. Is it safe to extrapolate the old ID based on the new ID value?
 
- There is a problem fetching "Orders" plus "Transactions" or "Refunds". When including "Refunds" or "Transactions" as a part of the graph query, we get an error back: “Queries that contain a connection field within a list field are not currently supported.” We don't think there is a way to directly load transactions and refunds but even if there is it greatly hinders the way we have to fetch the data given the limits already in place (single bulk query, and manually reconstructing the object graph from the jsonl files).
 
- When querying "Collections", we get an error back stating ACCESS_DENIED. There is no specific error on any field and all the other queries work with the same store. What is the required permission to run a query on "Collections"?
 
- Some queries that work fine and have been tested and work fine on some stores, fail for some others. e.g. when running our Orders query, there is an "INTERNAL_SERVER_ERROR" shown shortly after requesting the data (via bulk query api). How do we investigate such cases? There is absolutely no detail given along with the error.
 
Finally, since we are already using the REST Api but via pagination to load the data, we thought our current programming model matches the new REST Api and the relative cursor-based model better. Is the cursor-based REST Api safe to use and upgrade to, or is that also something that'd get decommissioned in the near future?
0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 103 124

Hey @wrath_e ,

 

I would be happy to help you go through your questions and concerns regarding the new GraphQL Bulk Operations API

 

There are fields missing in almost all the above entities when comparing to the old API.

In general, the Shopify GraphQL Admin API should have the same fields, objects, entities and data available through it that the Shopify REST Admin API has. However some fields and attributes may be renamed or moved to other objects, which may be making it more difficult to find them. If you could provide the comparison list I would be able to help take a look to see if the equivalent field does exists in GraphQL Admin API or see if there is truly missing fields that should be fixed and ported over. 

 

Some objects like OrderLine used to have an ID that we rely on

Could you clarify what exactly you mean by the "OrderLine" object in the Shopify Rest Admin API? But in general yes it is safe to extrapolate the old ID based on the new ID, and vice versa. 

 

There is a problem fetching "Orders" plus "Transactions" or "Refunds".

On my end I was able to make a Bulk Operations Query for "Orders" that fetches connections of "Transactions" and "Refunds" with no issues. See below for my Bulk Operations query. It may be that you have included `refundLineItems (first: XXX)` with connections in your Bulk Operations Query that is causing that error to be thrown since that is not supported, but you could still get the same desired information if you just query for `lineItems` directly on the Order

 

 

mutation {
  bulkOperationRunQuery(
   query: """
   {
  orders {
    edges {
      node {
        id
        totalPriceSet {
          shopMoney {
            amount
          }}
        name
        displayFinancialStatus
        displayFulfillmentStatus
        
        refunds {
            id
        }
        lineItems {
          edges {
            node {
              id
              variant {
                id
              }
              quantity
              fulfillmentStatus
              fulfillableQuantity
              refundableQuantity
            }}}
        transactions {
          id
          kind
          amountSet {
            shopMoney {
              amount
    }}}}}}}
    """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}

 

 

When querying "Collections", we get an error back stating ACCESS_DENIED.

You require the access scopes of "read_products" and "write_products" to query for Collections

 

Some queries that work fine and have been tested and work fine on some stores, fail for some others.

For Internal Server Errors, you can try re-running the query again at a later time (since these errors tend to be caused by server timeout or too much traffic). If you see this error happening constantly then you can come to the Community Forums and provide the value of the "X-Request-ID" header from your API error response, and someone from Shopify should be able to help you troubleshoot the problem

 

Finally, since we are already using the REST Api but via pagination to load the data, we thought our current programming model matches the new REST Api and the relative cursor-based model better

You should be fine to use the REST API with pagination in the near future. We version all of our APIs so if we ever decide to deprecate anything in the future, you will be given notification well in advance. 

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes