A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
I've been unable to find the answer in documentation, SO or this community so far, so I have to ask:
How do I get the last 5 most recent orders via GraphQL Admin API?
My current query is below. I also tried using last:5 but it requires a before param and I don't understand why or how to use that. Also please correct my customAttributes query syntax if it's wrong.
{
orders(first:5) {
edges {
node {
id
name
customAttributes
{
key:value
}
}
}
}
}
Solved! Go to the solution
This is an accepted solution.
I finally found the answer (sorry, can't remember the source and don't have the link anymore). The solution is to use first: 5, and reverse: true to make it the last 5 most recent orders
orders(first: 5, reverse:true)
This is an accepted solution.
I finally found the answer (sorry, can't remember the source and don't have the link anymore). The solution is to use first: 5, and reverse: true to make it the last 5 most recent orders
orders(first: 5, reverse:true)