ShopifyQL

Highlighted
New Member
3 0 1

Hello,

 

I've created a report via my app and I have its ShopifyQL query. So I'd like to know how I can pull the report ( quantity_sold, ending_quantity e.t.c. ) using that query via REST API ( PHP )?

 

Thanks.

1 Like
Highlighted
Excursionist
38 1 8

I'm just going over the post from the last few days. This is the second one with ShopifyQL related topic and both has no answers. My guess is that's because the answer is NO or it is hidden deeply in the docs. 

https://apps.shopify.com/picamaze
Animated watermarks for product images and ads
1 Like
Highlighted
Tourist
8 0 1

I too would like like to query the sales data using ShopifyQL via REST for accounting purposes. Why is this not exposed from the REST API?  It has to be less resource intensive than fetching all the orders and manually aggregating the data, as i'm currently forced to do.

0 Likes
Highlighted
Shopify Partner
531 38 109

You can create a new report that will directly appear in the Shopify web admin. Using ShopifyQL for the query itself, and the Report API accepts REST requests for manipulating the reports. As long as the shop is on Shopify Advanced or Shopify Plus this functionality is available.

Check this out for details --> https://shopify.dev/docs/admin-api/rest/reference/analytics/report#create-2020-07

0 Likes
Highlighted
Tourist
8 0 1

Thanks, but that not exactly the use case I'm describing. We do not want to view the report in the Shopify dashboard. We need to fetch this data for insertion into a separate data warehouse for our accounting team. Hence the need for REST access to the report data.

Bottom line is, we are looking for programmatic access to the results of  the created reports.

0 Likes
Highlighted
Shopify Partner
531 38 109

Unless I'm mistaken I think your two primary options are the REST API or the GraphQL API. You have more control of the specific fields you need with the latter option. If it's a scheduled task of pulling the data from Shopify and pushing it over to your accounting package then it should consist of a basic API request, where the response then gets pushed over into accounting. If it's a specific requirement for your own Shopify shop then you create a private app, install it within your Shopify shop, and use the API credentials to authenticate within your private app.

0 Likes
Highlighted
Tourist
8 0 1

Yes, but neither of REST API or GraphQL api provides access to running queries with ShopifyQL. Pulling down every order to get a summary of what was sold and and refunded for the day seems absurd, when there's a perfectly good solution already implemented, but limited to dashboard access only. 

0 Likes
Highlighted
Shopify Partner
531 38 109

Perhaps someone from the Shopify team can chime in here. But as far as I'm aware you can't access the ShopifyQL except via an embedded app SDK. This same train of thought goes back a-ways --> https://community.shopify.com/c/Shopify-APIs-SDKs/How-do-you-query-Analytics-API-without-the-embedde...

Honestly, if it's just a quick pull of daily sales counts and totals then pull via REST of GQL, iterating through the records totaling them up, and pushing over into another receiver isn't that big of a deal. I've implemented that for production apps working with at least 3-4 different provider endpoints. While it's not as efficient as a SQL-type query, it's not terribly ungainly.

0 Likes
Highlighted
Tourist
8 0 1

Yes, I've implemented a process as you've described, getting orders for a given date and summing them. However, I need to also get refunds which apparently are NOT directly query-able by date, one must go though orders. So I can can keep banging my head against the wall trying to account for all of Shopify's business logic by querying raw data.... or they could simply expose programmatic reporting to API users.

0 Likes
Highlighted
Shopify Expert
4187 29 410

Keep on banging your head. Also, be aware that some Shopify reports are actually not useful for accounting as they have bizarre features. So depending on them might not be in your best interest. 

You say you can't get refunds? They are simply Transactions and they are indeed available, simply by providing the ID of the order they belong to. So it is pretty straight forward to download an order, and all its transactions and have as accurate a source of data as you could hope for. In some cases perhaps, even more accurate than Shopify itself!

For all the work you'd do in accessing reports to feed your system, just working with the actual data is not much more, and it puts you in the driver's seat, where you probably want to be. Will save you the headache of mistakes down the line when you assuming you were feeding the good stuff into maw but weren't.

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes