delete the discount code through API, "discountCodeDelete" Error,error message:“invalid id”

delete the discount code through API, "discountCodeDelete" Error,error message:“invalid id”

张银
Tourist
10 0 2

help me! I tried to delete the discount code through API。Use restful API  was successful, Use  graphQL API was error. What's the reason.

note: ID is real.

Use the API:

Shopify Admin API (grapQL)  :

 

mutation discountCodeDelete($id: ID!) {
  discountCodeDelete(id: $id) {
    deletedCodeDiscountId
    userErrors {
      code
      extraInfo
      field
      message
    }
  }
}

 

input:

 

{
  "id": "gid://shopify/PriceRuleDiscountCode/11931057553557"
}

 

 return:

 

{
    "data": {
        "discountCodeDelete": null
    },
    "errors": [
        {
            "message": "invalid id",
            "locations": [
                {
                    "line": 3,
                    "column": 3
                }
            ],
            "path": [
                "discountCodeDelete"
            ]
        }
    ],
    "extensions": {
        "cost": {
           ...
        }
    }
}

 

 

Reply 1 (1)

sisyphus
Shopify Partner
1 0 0

found the answer ? im having the issue too