A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hello, i am trying to get refund and partial refund information from the API that has the following specifications:
1. We have shopify plus, and multiple stores on shopify plus. If there is a way to pull data for all of these stores in 1 api call that would be highly preferable. As far as i can tell each store has its own generated API keys, but i haven't actually tested this yet.
2. The refunds need to be able to happen at basically any time, and i need to be able to pull all of the refunds that have happened, not an individual refund.
3. I need each row to correspond to a single order, and i need the utm variables in that row. This is because ultimately this data is going into data studio as a "minus" against another table that just counts orders(which is simple enough)
4. I need this all in USD, from every store. (currently i vlookup and cross reference the date via an API, so this is outside of shopify, but if theres a way to do this in shopify that'd be even better)
5. We use a post purchase app. Figured i would just mention this because it seems to complicate every other aspect of tracking.
Some notes/things that I can't figure out that would simplify the process:
1. graphql filters have no documentation or easy to read documentation for what their labels are. for example. the orders filter says "financial_status" is a filter, but there is no direct documentation as to what the specific financial_status is. is it REFUNDS or all_refunds or partial_refunds, etc. etc. I see the documentation for the syntax(which honestly was also kind of confusing), but even if i understood the syntax perfectly I don't see how i can use a filter without knowing what the dimensions of the filter are.
2. I would very much like to be able to pull all of our stores data with one API key if thats possible.
I am currently able to pull the above data but its through an extremely clunky/prone to error process and im trying to simplify it as much as humanly possible.
I basically pull graphql API order sale data every hour and add to google sheets via api addon.
I then pull REST api orders and filter by refunds into another excel tab. I manipulate the REST api data so that each refund only appears as one order transaction, and vlookup to the original sale sheet to get UTM variables.
And this is just one store, with this set up im going to have to have to have 3+ google sheet tabs, and 3 API calls per store. This is obviously way too confusing to maintain and have data accuracy if i have 5+ stores.
Any and all help on this would be appreciated, thanks in advance.
Here is my current attempt at getting the information with just the graphl API, but the filter doesnt seem to work.
{orders(first:100,after:*dynamicallygeneratedid*, query:"financial_status:REFUNDED"){
edges{cursor
node{
id
createdAt
currentTotalPriceSet {shopMoney{amount}}
currentTotalTaxSet {shopMoney{amount}}
currencyCode
customerJourneySummary{
firstVisit{
utmParameters {
campaign
content
medium
source
term
}
}
lastVisit{
utmParameters {
campaign
content
medium
source
term
}
}
}shippingAddress{
country
}
}
}
}
}