Hey @ChrisBradley, good news since we last chatted. The shopifyqlQuery endpoint is now available in the Admin API (changelog). This means you can now run analytics queries through Graphql. For example:
{
shopifyqlQuery(query: """
FROM inventory_adjustment_history
SHOW inventory_adjustment_change, inventory_adjustment_count
GROUP BY product_variant_sku, day, reference_document_type
HAVING inventory_adjustment_change != 0
SINCE -1d
UNTIL today
ORDER BY day DESC
LIMIT 100
""") {
tableData {
columns { name dataType displayName }
rows
}
parseErrors
}
}
The reference_document_type field shows the movement type (Order, Return, etc.), so you can filter or group by that. Your app will need the read_reports scope.
Pro tip, sidekick in your admin can be a great help in building out some of these queries. Here’s a skill to get you started via Sidekick in your admin.