Parse Errror With Graph QL when updating column values

Hello ,
I’m trying to create a row in a group with specific column value , so itried the following mutation query :

  mutation {
    create_item (board_id: 30282029, group_id: "new_groupe3628", item_name: "new item" , column_values: "{\"text1\" : \"hello\"}") {

Wich work perfectly on the monday graphql developer tool

But when I put it in my code and use it I always get the same error :

Parse error on " : " (STRING) at [3, 116]: 
{"response":{"errors":[{"message":"Parse error on \" : \" (STRING) at [3, 116]","locations":[{"line":3,"column":116}]}],"account_id":2436059,"status":200},"request":{"query":"\n  mutation {\n    create_item (board_id: 716535551, group_id: \"nouveau_groupe36728\", item_name: \"new item\" , column_values: \"{\"text1\" : \"hello\"}\") {\n    id\n    }\n    }\n  "}}

Can Someone Help Me ?


Hello @coral!
You can just add one more pair of quotes to your mutation string. Like this:

var mutation = ‘“mutation { create_item (board_id: 30282029, group_id: “group”, item_name: “new item” , column_values: “{“text1” : “hello”}”) { id }}”’;

When you use only one pair GraphQL sees all special characters as its own syntax part and tries to handle.

1 Like

Thanks For Your answer , I tried The mutation you gave me and it didn’t work I just got this error message

Error: Parse error on "group" (IDENTIFIER) at [1, 56]: {"response":{"errors":[{"message":"Parse error on \"group\" (IDENTIFIER) at [1, 56]","locations":[{"line":1,"column":56}]}],"account_id":2436059,"status":200},"request":{"query":"\"mutation { create_item (board_id: 30282029, group_id: \"group\", item_name: \"new item\" , column_values: \"{\"text1\" : \"hello\"}\") { id }}\""}}

Is there another way to solve this problem ?


Hi @coral!

Of course you have an error with my mutation :slight_smile: Because there is my data for my group and account.

For your case you should pass your own mutation which you’ve tried to handle here:

‘"mutation { create_item (board_id: 30282029, group_id: “new_groupe3628”, item_name: “new item” , column_values: “{“text1” : “hello”}”) { id }}’"

1 Like

Which tool do you use for request sending? Or which programming language?

hello ,
First , I changed of course the mutation to adapt it to my code and it did not work , I’m using node js (javascript ) and the node module graphQLClient to make the request

Sorry, @coral.
I’ve read your answer not careful enough. It’s my mistake.

Instead of escaping all mutation wholly you can add escaping only in problem place like here:

var mutation = “mutation {create_item (board_id: 557252806, group_id: \“somes4\”, item_name: \“new item2\” , column_values: \”{\\\“text1\\\” : \\\“hello\\\”}\") {id}}";

You should pass to the server column_values like:

"{\“text1\” : \“hello\”}"

But GraphQL “unwraps” your quotes, so you can just escape \ and " separately:

\"{\\\“text1\\\” : \\\“hello\\\”}\"

I have this response: {“data”:{“create_item”:{“id”:“863374806”}},“account_id”:61627}

thanks a lot , it worked
in this case we have to json stringify the object of column values two times , that was not indicated in the doc …
Anyway now it works thanks

1 Like

So glad that @olena could help you, @coral!