Shopify GraphQL Bulk API inventory levels

Shopify GraphQL Bulk API inventory levels

pascalachkar
Shopify Partner
2 0 1

Hey there, 

 

I am trying to fetch the inventoryLevels via connection using the Shopify GraphQL Bulk API but each time I start a Bulk Operation, I get the error 

INTERNAL_SERVER_ERROR

 

The query I am using is the following:

 

 

mutation {
  bulkOperationRunQuery(
   query: """
    query InventoryLevels {
  products(query: "published_status:published") {
    edges {
      node {
        __typename
        id
        variants {
          edges {
            node {
              __typename
              id
              ... on ProductVariant {
                inventoryQuantity
                inventoryPolicy
                inventoryManagement
                inventoryItem {
                  id
                  requiresShipping
                  tracked
                  inventoryLevels {
                    edges {
                      node {
                        __typename
                        id
                        ... on InventoryLevel {
                          canDeactivate
                          createdAt
                          location {
                            id
                          }
                          quantities(names: ["available"]) {
                            name
                            quantity
                            updatedAt
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
    """
  ) {
    bulkOperation {
      id
      status
    }
    userErrors {
      field
      message
    }
  }
}

 

 

Please note that I already have the read_inventory/write_inventory access scopes, is there any additional requirement to be able to query the inventoryLevels via Bulk API ?

 

PS: When I try the GraphQL query directly (without the Bulk API) for a couple of products, the API is returning data, the issue is only happening when I am using the Bulk API as we need to fetch all the data for all the products.

 

X-Request-ID of the failed operation request is 3b9502f0-4c5d-4907-a1c5-fa8a84e77366

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 511

Hi @pascalachkar,

 

The bulk query you provided is working normally and returning results when used on a test store. 

 

We try to keep the forums to general non-store-specific replies to help maintain privacy so please reach out to Partner support via the Partner dashboard and choose the API Email us option to begin a support interaction so this can be investigated further. In the form please also include a date/time/timezone to go with the x-request-id (which should be within the past 7 days), as well as which store and which app are involved.

 

Thanks and have a great day,
Jon551

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us 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