Major issues with ShopifyQL, can't access proper API

Trendmo
Shopify Partner
2 0 0

We've been trying to use the ShopifyQL using both the legacy Embedded App SDK and the Shopify App Bridge, and neither seems to work. 

 

Code tested for Embedded App SDK:

 

ShopifyApp.ready(function(){
   var shopifyQL = "SHOW count() FROM visits SINCE -2w UNTIL today";
   var renderData = function(response) {
     // do amazing things here
   };
   var handleError = function(response) {
     // handle missing API errors here (missing scopes, back shopifyql, etc...)
   };
   ShopifyApp.Analytics.fetch({
     query: shopifyQL,
     success: renderData,
     error: handleError
   });
 });Code tested for Shopify App Bridge:       var AppBridge = window['app-bridge'];
       var createApp = AppBridge.default;       var app = createApp({
         apiKey: "xxxxxxxxxxxxx",
         shopOrigin: "xxxxxxxxxxxxxxxxxx",
       });       console.log(app);       console.log(AppBridge);       AppBridge.actions.Analytics.fetch({
           query: 'SHOW count() FROM visits SINCE -2w UNTIL today',
           success: () => { console.info('success'); },
           error: () => { console.info('error'); },
       });(xxxxxxx in above example are filled with correct data, and app is correctly created)This code does not work because

 

Analytics does not exist in actions (correct according to https://help.shopify.com/en/api/embedded-apps/app-bridge/actions).

 

Question is: how do you initialize and query the ShopifyQL object using either the Shopify App Bridge or Embedde App SDK.

0 Likes
iain-campbell
Shopify Staff
Shopify Staff
54 9 20

Hi Trendmo,

 

ShopifyQL is not supported in App Bridge, but it is supported using the Embedded App SDK. Make sure that the shop you’re trying to query is on the Advanced Shopify plan, and that your app has the reports_editing permission (https://help.shopify.com/en/api/guides/analytics-api#shop-requirements).

iain-campbell | Developer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes
Trendmo
Shopify Partner
2 0 0

Hi there, thanks for getting back to us so quickly! 

 

We are currently using a dev store to work on connecting the API. Do dev stores allow for this endpoint to be tested? Or is the reason we are getting this error because we are not on the advanced plan?

 

We were under the impression that dev plans can test these endpoints, rather than us upgrading to the advanced plan to pull in test data. 

 

 

0 Likes
iain-campbell
Shopify Staff
Shopify Staff
54 9 20

Development stores should have access to all advanced plan features; that shouldn’t be the issue. What is the error you’re getting?

iain-campbell | Developer @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes