如何进行ShopifyQl查询?
Shopify最近宣布 shopifyql ,以便于访问分析数据。但是,我尚不清楚如何真正拨打ShopifyQl。它们确实包括示例。
{
# "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
}
}
}
}
}
但是,使用 graphiql 工具来运行查询的工具,以运行多个错误:
{
"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"
}
}
]
}
我还尝试使用我的应用程序的节点服务器进行以上查询的示例查询进行认证的调用,但遇到了相同的问题。
我在这里想念什么?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看来它仅适用于当前不稳定版本:
https://“+shop_name+” .myshopify.com/admin/admin/api/api/dograble/graphql.json
成功地响应了这一点。
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.
这仍然对您有用吗?
https://storename.myshopify.com/admin/admin/api/api/unstable/graphql。 JSON
这是过去6个月的工作。但是现在它被拒绝了。
“代码”:“ access_denied”,
“文档”:“ https://shopify.dev/api/usage/access-scopes”,
“必需访问”:“
read_reports
访问范围,read_customers
访问范围,read_felfillments
访问范围,read_inventory
访问范围,访问范围,<代码> read_orders 访问范围,read_products
访问范围和read_all_orders
访问范围”}
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 andread_all_orders
access scope"}