GraphQL variables not working when getting order by name

I’m trying to look up an order by name, this is my code

# Get an order by order name field
  query = ShopifyAPI::GraphQL.client.parse <<-'GRAPHQL'
    query($query: String) {
      orders(first: 1, query: $query) {
        edges {
          node {
            id
            name
            createdAt
          }
        }
      }
    }  
  GRAPHQL

  variables = {
    query: "name:2456"
  }

  result = ShopifyAPI::GraphQL.client.query(query)

It should return the order passed in the variables, but instead returns the very first order in the database.

What am I doing wrong here?

You need to wrap your name in single quotes to get that to work.

{
	"query": "name:'Test#1234'"
}

Works for me perfect.

Hi @HunkyBill thanks for answering!

I tried that, and it didn’t change the result unfortunately. Still not getting back the queried order.

Hi @PurpleMamba ! I am facing the same issue. Did you get it resolved by any chance?