Skip to main content

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?


{ errors: 

[ { message: ‘Parse error on " : " (STRING) at t5, 127]’,

locations: nObject] } ],

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 } }”


@Matias.Monday, thanks for the suggestion. I still got a parse error.


10:04:23 AM Info { errors:

[ { message: ‘Parse error on " : " (STRING) at t1, 121]’,

locations: nObject] } ],

account_id: 11852553 }


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 🙂


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


Hi @alcantaralinaresm,


Please share the query you’re working with so we can help troubleshoot


Reply