基于此 Shopify文档,我正在尝试执行此 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 代码,因为你找不到可以在下图中看到: