Coda415
(Colin Davis)
August 10, 2022, 5:35pm
1
I’ve had success in creating new items on the board that I want from my Google apps script, but where I run into trouble is in the column_value part. Can’t quite seem to track down where I’m going wrong.
function myNewItem(){
var baseURL = “https://api.monday.com/v2 ”
var mondayApiToken = “mondayToken”
var query = mutation newItem { create_item(board_id: 2942342848, group_id: "new_group85282", item_name: "test2", column_values: "{\"edit_request\" : \"New text\"}"){ id } }
var headers = {
“Authorization”: mondayApiToken,
“Content-Type”: “application/json”
}
var options = {
headers: headers,
method: "Post",
payload: JSON.stringify({
query: query
})
}
var response = UrlFetchApp.fetch(baseURL, options).getContentText()
var result = JSON.parse(response)
console.log(“result:”, result.data)
}
Hi @Coda415 ,
Welcome to the community! We hope you like it here
Could you please share the error you are seeing when trying to create an item?
Coda415
(Colin Davis)
August 10, 2022, 8:20pm
3
{ errors:
[ { message: ‘Parse error on " : " (STRING) at [5, 127]’,
locations: [Object] } ],
account_id: 11852553 }
Hello there @Coda415 !
Could you please try this and let me know what happens?
var query = “mutation { create_item(board_id: 2942342848, group_id: "new_group85282", item_name: "test2", column_values: "{\"edit_request\" : \"New text\"}"){ id } }”
Coda415
(Colin Davis)
August 11, 2022, 3:07pm
5
@Matias.Monday , thanks for the suggestion. I still got a parse error.
10:04:23 AM Info { errors:
[ { message: ‘Parse error on " : " (STRING) at [1, 121]’,
locations: [Object] } ],
account_id: 11852553 }
Coda415
(Colin Davis)
August 11, 2022, 3:15pm
6
Also, for what it’s worth I can get it to work in the API playground. With this:
mutation{
createItem1: create_item(board_id: 2942342848, group_id: “new_group85282”, item_name: “test”, column_values:
“{"edit_request" : "test"}”) {
id
name
}
createItem2: create_item(board_id: 2942342848, group_id: “new_group85282”, item_name: “test2”, column_values: “{"edit_request" : "New text"}”) {
id
}
}
Hi @Coda415 !
I’m sure it is just a silly thing we are missing here. But to avoid many back and forths, would you be able to schedule a meeting with us here so that we can take a look together?
We can probably solve it in a few minutes taking a look into the code together
1 Like
cboydst
(Caleb Boydston)
October 27, 2022, 10:27pm
8
Hey!
This is actually the exact issue that I am running into. I was wondering if you or @Matias.Monday were able to find the solution. I can’t wrap my ahead what the problem could be!
Thanks
Hello @cboydst !
Honestly I do not remember our call from a few months ago
@Coda415 do you remember?
If not, @cboydst , you can schedule a call here so we can take a look!
Cheers,
Matias
I am having the same issue. How was this resolved? @Matias.Monday
alessandra
(Alessandra)
January 20, 2023, 5:08pm
11
Hi @alcantaralinaresm ,
Please share the query you’re working with so we can help troubleshoot