<p>Just in case this helps someone I finally determined that my GraphQL Schema did not have the appropriate Mutations available/enabled in the Craft admin panel. In this case the mutation that allows for creating an entry in that particular section. </p>

CC BY-SA 4.0
2023-02-01T20:39:09.990Z
2023-02-01T20:39:09.990Z
Kirk Roberts
<p>In Craft 3 I am trying to use GraphQL to mutate an existing entry in the section PersonEvents.</p>
<p>Here is what I have in PHP</p>
<pre><code>$mutation = &lt;&lt;&lt;QUERY
mutation saveEntry(\$id: ID, \$avatarUrls: String) {
  save_personEvents_default_Entry(id: \$id, avatarUrls: \$avatarUrls) {
    id
    avatarUrls
  }
}
QUERY;

$variables = &lt;&lt;&lt;VARIABLES
{
  &quot;id&quot;: &quot;$personEventId&quot;,
  &quot;avatarUrls&quot;: &quot;$avatarUrlsString&quot;
}
VARIABLES;
</code></pre>
<p>If it is important, avatarUrls is a table field and I'm sending in a string like <code>&quot;[{col1:\&quot;\/svgavatars\/ready-avatars\/svgA013650824185873711.png\&quot;}]&quot;</code>.</p>
<p>What I get back is</p>
<pre><code>{
    &quot;errors&quot;: [
        {
            &quot;message&quot;: &quot;Cannot query field \&quot;save_personEvents_default_Entry\&quot; on type \&quot;Mutation\&quot;.&quot;,
            &quot;extensions&quot;: {
                &quot;category&quot;: &quot;graphql&quot;
            },
            &quot;locations&quot;: [
                {
                    &quot;line&quot;: 2,
                    &quot;column&quot;: 3
                }
            ]
        }
    ]
}
</code></pre>
<p>I am looking at documentation at <a href="https://craftcms.com/docs/3.x/graphql.html#mutations" rel="nofollow noreferrer">https://craftcms.com/docs/3.x/graphql.html#mutations</a> and searching the web for clues and still feel like I'm missing something elementary.</p>
<p>Any ideas to point me in the right direction would be greatly appreciated! Thanks!</p>
<p>=== additional info ===</p>
<p>If I run this in GraphiQL it works, saving the avatarUrls data:</p>
<pre><code>mutation saveEntry {
  save_personEvents_default_Entry(
    id: &quot;1939&quot;
    avatarUrls: [{col1:&quot;/svgavatars/ready-avatars/svgA326319731994384-2.png&quot;}]
  ) {
    id
  }
}
</code></pre>
<p>... but if I try a <code>file_get_contents</code> in PHP with <code>query</code> set as that string I get back</p>
<pre><code>{
    &quot;errors&quot;: [
        {
            &quot;message&quot;: &quot;GraphQL\\Type\\Definition\\Type::getNullableType(): Argument #1 ($type) must be of type GraphQL\\Type\\Definition\\Type, null given, called in [redacted]\/vendor\/webonyx\/graphql-php\/src\/Validator\/Rules\/ValuesOfCorrectType.php on line 75&quot;
        }
    ]
}
</code></pre>
<p>What am I missing?</p>

CC BY-SA 4.0
2023-01-30T18:54:50.987Z
When no one answers I never know if it's because I didn't provide enough detail, wasn't courteous enough, "should" know the answer, didn't provide enough evidence of putting in work before asking, or something else. If something is getting in the way of anyone answering, please educate me about how to ask in a better way!
Kirk Roberts
CC BY-SA 4.0
2023-02-01T19:05:56.673Z
Added some more info to the question.
Kirk Roberts
<craft3><graphql>
With GraphQL why am I getting the error "Cannot query field \"save_personEvents_default_Entry\" on type \"Mutation\". "?
# With GraphQL why am I getting the error "Cannot query field \"save_personEvents_default_Entry\" on type \"Mutation\". "?

(Asked by: username_0 on 2023-01-26)

In Craft 3 I am trying to use GraphQL to mutate an existing entry in the section PersonEvents.
Here is what I have in PHP
$mutation = <<
If it is important, avatarUrls is a table field and I'm sending in a string like "[{col1:\"\/svgavatars\/ready-avatars\/svgA013650824185873711.png\"}]".
What I get back is
{
    "errors": [
        {
            "message": "Cannot query field \"save_personEvents_default_Entry\" on type \"Mutation\".",
            "extensions": {
                "category": "graphql"
            },
            "locations": [
                {
                    "line": 2,
                    "column": 3
                }
            ]
        }
    ]
}

I am looking at documentation at https://craftcms.com/docs/3.x/graphql.html#mutations and searching the web for clues and still feel like I'm missing something elementary.
Any ideas to point me in the right direction would be greatly appreciated! Thanks!
=== additional info ===
If I run this in GraphiQL it works, saving the avatarUrls data:
mutation saveEntry {
  save_personEvents_default_Entry(
    id: "1939"
    avatarUrls: [{col1:"/svgavatars/ready-avatars/svgA326319731994384-2.png"}]
  ) {
    id
  }
}

... but if I try a file_get_contents in PHP with query set as that string I get back
{
    "errors": [
        {
            "message": "GraphQL\\Type\\Definition\\Type::getNullableType(): Argument #1 ($type) must be of type GraphQL\\Type\\Definition\\Type, null given, called in [redacted]\/vendor\/webonyx\/graphql-php\/src\/Validator\/Rules\/ValuesOfCorrectType.php on line 75"
        }
    ]
}

What am I missing?

**Tags:** craft3, graphql
> **Comments:**
> **username_0**: When no one answers I never know if it's because I didn't provide enough detail, wasn't courteous enough, "should" know the answer, didn't provide enough evidence of putting in work before asking, or something else. If something is getting in the way of anyone answering, please educate me about how to ask in a better way!  
> **username_0**: Added some more info to the question.  

---

## 1 answers

### Answer by username_0 on 2023-02-01. Score: 2

Just in case this helps someone I finally determined that my GraphQL Schema did not have the appropriate Mutations available/enabled in the Craft admin panel. In this case the mutation that allows for creating an entry in that particular section.


---

