【发布时间】:2019-05-08 15:21:44
【问题描述】:
基于这个 Shopify documentation,我正在尝试执行这个 GraphQL 查询:
query getDiscount($code: DiscountCodeSortKeys) {
priceRules(first: 1) {
edges {
node {
discountCodes(first: 1, sortKey: $code) {
edges {
node {
code
id
}
}
}
}
}
}
}
在我的 Shopify 管理页面的 GraphiQL 中,我得到以下输出:
{
"data": {
"priceRules": {
"edges": [
{
"node": {
"discountCodes": {
"edges": [
{
"node": {
"code": "discount_code_1",
"id": "gid://shopify/PriceRuleDiscountCode/1888888"
}
}
]
}
}
}
]
}
},
"extensions": {
"cost": {
"requestedQueryCost": 6,
"actualQueryCost": 6,
"throttleStatus": {
"maximumAvailable": 1000,
"currentlyAvailable": 994,
"restoreRate": 50
}
}
}
}
但是,当我在编辑 HTTP 标头并放置 GraphQL 端点 (https://my_domain.com/api/graphql) 后在 GraphiQL IDE 中执行相同的查询时,我得到一个标题为 404 页面的 html 代码,如图所示下面:
【问题讨论】:
标签: graphql shopify storefront graphiql