基于此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中执行相同的查询时,我得到了一个html代码,其标题为404 page,如您所见下图:
答案 0 :(得分:0)
问题出在选择的方法“ GET”上,当我选择“ POST”方法时,它起作用了。