Bulk GraphQL (Ruby): get orders since specific date

Highlighted
Shopify Partner
15 0 2

Hi,

I can obtain a list of orders since a specific date using GraphQL, but can't seem to do so via Bulk

Non Bulk GraphQL - working

 

 

query ($query_string: String, $first: Int) {
  orders(query: $query_string, first: $first) {
    edges {
      node {
        id
        legacyResourceId
        name
        processedAt
        cancelledAt
      }
    }
  }
}

 

 

 

Here's the BULK QUERY

 

 

  QUERY_BULK= ShopifyAPI::GraphQL.client.parse <<-'GRAPHQL'
    mutation {
      bulkOperationRunQuery(
       query : """
        { 
          OrdersQuery($query_string: String): orders(query: $query_string) {
            edges {
              node {
                id
                legacyResourceId
                name
              }
            }
          }
        }
        """
      ) {
        bulkOperation {
          id
          status
        }
        userErrors {
          field
          message
        }
      }
    }
  GRAPHQL

 

 

 

and it's called via

 

 

client = ShopifyAPI::GraphQL.client
variables = {"query_string": "created_at:>=2020-01-01" }
result = client.query(QUERY_BULK, variables: variables) 

 

 

 

But I'm getting:

 

 

"Parse error on \"QUERY_BULK\" (IDENTIFIER) at [1, 3]"

 

 

I've tried placing `($query_string: String)` in various places of the GraphQL Query and it's not working. 

I have a few questions:

  • Does Shopify BULK GraphQL query support variables?
  • If so, how does someone run a query like get me all orders since XXX date, where the date can change?
0 Likes