Shopify最近发布了ShopifyQL来方便访问分析数据。但是,我不清楚如何实际调用ShopifyQL。他们确实包含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
}
}
}
}
}
但是,使用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"
}
}
]
}
我还尝试使用应用的Node服务器通过上面的示例查询进行身份验证调用,但遇到了相同的问题。
我错过了什么?
2条答案
按热度按时间ogsagwnx1#
看起来它只适用于目前不稳定的版本:
https://"+商店名称+".myshopify.com/admin/api/unstable/graphql.json
得到了成功的回应。
wljmcqd82#
这对你来说还管用吗?https://storename.myshopify.com/admin/api/unstable/graphql.json
这是过去6个月的工作。但现在它获得访问被拒绝。“代码”:“访问被拒绝”,“文档”:“https://shopify.dev/api/usage/access-scopes“、“所需访问权限”:
read_reports
访问作用域、read_customers
访问作用域、read_fulfillments
访问作用域、read_inventory
访问作用域、read_orders
访问作用域、read_products
访问作用域和read_all_orders
访问作用域