coral
(Elie)
November 15, 2020, 2:21pm
1
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\"}") {
id
}
}
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 :
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 ?
Thanks
olena
(Olena)
November 15, 2020, 5:34pm
2
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
coral
(Elie)
November 16, 2020, 8:07am
3
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 ?
Thanks
olena
(Olena)
November 16, 2020, 9:16am
4
Hi @coral !
Of course you have an error with my mutation Because there is my data for my group and account.
olena
(Olena)
November 16, 2020, 9:20am
5
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
olena
(Olena)
November 16, 2020, 9:22am
6
Which tool do you use for request sending? Or which programming language?
coral
(Elie)
November 18, 2020, 7:51am
7
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
olena
(Olena)
November 18, 2020, 3:32pm
8
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}
coral
(Elie)
November 18, 2020, 4:30pm
9
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
dipro
(Dipro Bhowmik)
November 26, 2020, 3:48pm
10
So glad that @olena could help you, @coral !
system
(system)
Closed
February 17, 2021, 4:36pm
11
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.