How does one get a list of orders from the shopify Graphql api? I can't even figure out how to get a single order. The nearest I can tell is that my query should look something like this:
query{
node(id:$id){
__typename
... on Order{
id
email
}
}
}
Where $id
is "An object with an ID to support global identification" according to the docs, but its not clear what that means. For a product, you can retrieve the id like so:
shop {
productByHandle(handle: "red-bicycle") {
id
}
}
Which will then return a hash, like this:
Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0Lzk4OTUyODE0NzU=
You can then query a product using the node interface like this:
node(id: "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0Lzk4OTUyODE0NzU=") {
id
... on Product {
title
}
}
But how is this done for an order? For a list of the most recent 5 orders? Why do you have to use the Node interface at all? Why not just query by handle or ID or something instead of using the hash?