skip to Main Content

Shopify recently announced ShopifyQL for easier accessing of analytics data. However, I’m unclear of how to actually make a ShopifyQL call. They do include an example.

{
  # "FROM sales SHOW total_sales BY month SINCE -1y UNTIL today" passes a ShopifyQL query to the GraphQL query.
  shopifyqlQuery(query: "FROM sales SHOW total_sales BY month SINCE -1y UNTIL today") {
    __typename
    ... on TableResponse {
      tableData {
        rowData
        columns {
          # Elements in the columns section describe which column properties you want to return.
          name
          dataType
          displayName
        }
      }
    }
    # parseErrors specifies that you want errors returned, if there were any, and which error properties you want to return.
    parseErrors {
      code
      message
      range {
        start {
          line
          character
        }
        end {
          line
          character
        }
      }
    }
  }
}

However, using the GraphiQL tool to run the query hits a number of errors:

{
  "errors": [
    {
      "message": "Field 'shopifyqlQuery' doesn't exist on type 'QueryRoot'",
      "locations": [
        {
          "line": 3,
          "column": 3
        }
      ],
      "path": [
        "query",
        "shopifyqlQuery"
      ],
      "extensions": {
        "code": "undefinedField",
        "typeName": "QueryRoot",
        "fieldName": "shopifyqlQuery"
      }
    }
  ]
}

I also tried making an authenticated call with the example query above using my app’s Node server, but ran into the same issues.

What am I missing here?

2

Answers


  1. Looks like it only works with the unstable version currently:

    https://"+shop_name+".myshopify.com/admin/api/unstable/graphql.json

    Got a successful response with this.

    Login or Signup to reply.
  2. Is this still working for you?
    https://storename.myshopify.com/admin/api/unstable/graphql.json

    This was working for past 6 months. but now it getting access denied.
    "code": "ACCESS_DENIED",
    "documentation": "https://shopify.dev/api/usage/access-scopes",
    "requiredAccess": "read_reports access scope, read_customers access scope, read_fulfillments access scope, read_inventory access scope, read_orders access scope, read_products access scope and read_all_orders access scope"
    }

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search