Shopify GraphQL Mutation Doesn’t Work In CURL Or Postman But Does With GraphiQL App

Shopify GraphQL Mutation Doesn’t Work In CURL Or Postman But Does With GraphiQL App


0

When I’m using the following mutation in GraphiQL App it works perfectly but when I run it using Postman or CURL it just doesn’t work. This issue is happening for Function related mutations only.

The Mutation:

mutation {
    discountAutomaticAppCreate(
      automaticAppDiscount: {
        title: "Volume Discount Created from APP 011", 
        functionId: "9d8aas8-78asd-8d7sa-86f0-dg789asdfa9sd", 
        startsAt: "2023-09-19T00:00:00"}
    ) {
      
          # Payload
          userErrors {
              code
              field
              message
          }
          automaticAppDiscount {
              discountId
              title
              status
              createdAt
              endsAt
          }
      
    }
  }

The error that I get when using CURL or Postman:

"data": {
    "discountAutomaticAppCreate": {
        "userErrors": [
            {
                "code": "INVALID",
                "field": [
                    "automaticAppDiscount",
                    "functionId"
                ],
                "message": "Function not found."
            }
        ],
        "automaticAppDiscount": null
    }
}

Later I rechecked the "shop-name" and "api-version" both in GraphiQL and CURL, Postman. They all had same shop-name and api-version.
What can I do to solve the problem? Thanks!

1

  • can you show us your CURL requset

    – Hardik Satasiya

    21 mins ago


Load 5 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *