I have an app that pulls Refunds data from the REST API by first getting a list of orders and then calling the Refunds endpoint for each order. A customer using the app wants to get a list of Refunds that were created in a particular window. The window does not apply to the Order.
From the documentation, it looks like you can’t directly query for Refunds created or modified during a particular window. Is that correct? Has anyone been able to query Refunds on their created or modified dates in the REST API? Is this possible in the GraphQL API?
Hi @Kory_Hansen to the best of my knowledge, neither REST nor GraphQL directly allows you to query something like “give me all refunds within this date range” in the same way you can for Orders.
The typical approach is to retrieve the Orders first and then extract the refunds from each one.
With GraphQL you can do something like:
query($updatedAtMin: DateTime!, $updatedAtMax: DateTime!) {
orders(first: 50, query: "updated_at:>=$updatedAtMin updated_at:<=$updatedAtMax") {
edges {
node {
id
refunds {
id
createdAt
# other fields
}
}
}
}
}
Then filter the returned refunds by createdAt on your end.
Could you share the documentation that led you to consider that possibility?