GraphQL productCreate mutation returns "Expected value to not be null"

I’m using the following mutation (2024-07 GraphQL API):

mutation CreateProduct($input: ProductInput!) {
  productCreate(input: $input) {
    product {
      id
    }
    userErrors {
      message
      field
    }
  }
}

with the following parameters definition:

{
  "input": {
    "title": "Example product"
  }
}

And I get the following response:

[
  {
    "message": "Variable $input of type ProductInput! was provided invalid value",
    "locations": [
      {
        "line": 1,
        "column": 33
      }
    ],
    "extensions": {
      "value": null,
      "problems": [
        {
          "path": [],
          "explanation": "Expected value to not be null"
        }
      ]
    }
  }
]

I really don’t understand what I’m doing wrong… I’m pretty new to GraphQL, but this seemed pretty straightforward.

Any help would be greatly appreciated!

I was just sending the wrong request body.

For a query, POST request body should be {“query”, “parameters”}, but for a mutation, it should be {“query”, “variables”}.