Based on this Shopify documentation, I'm trying to execute this GraphQL query:
query getDiscount($code: DiscountCodeSortKeys) {
priceRules(first: 1) {
edges {
node {
discountCodes(first: 1, sortKey: $code) {
edges {
node {
code
id
}
}
}
}
}
}
}
In GraphiQL in my Shopify admin page I get this output:
{
"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
}
}
}
}
However, when I execute the same query in GraphiQL IDE after editing the HTTP headers and putting the GraphQL endpoint (https://my_domain.com/api/graphql), I get a html code with the title of 404 page not found as you can see in the picture below:
The problem was in the selected method "GET", it worked when I selected the "POST" method.