I’m receiving a ton of issues creating an item with column_values. I’ve gotten both the HTTP 500 error, parse errors on the column_id and parse errors on “{” and etc.
Can someone kindly help with this, here’s the rough code:
function createItem(){
var column = JSON.stringify({numbers:'88'});
var mutation = 'mutation{create_item(board_id:my_board_id, group_id:my_group_id, item_name:testingname, column_values:{numbers: 88}) {id} }';
var mutation1 = 'mutation{create_item(board_id:my_board_id, group_id:my_group_id, item_name:testingname, column_values:'+column+') {id} }';
var response = UrlFetchApp.fetch("https://api.monday.com/v2", {
method: 'post',
headers: {
'Content-Type': 'application/json',
'Authorization': apiKey
},
payload: JSON.stringify({
'query': mutation1
}),
muteHttpExceptions: true
})
Logger.log(JSON.stringify({'query': mutation}))
var json = response.getContentText()
var returndata = JSON.parse(json)
Logger.log(returndata)
}
Using mutation1 returns me “Parse error on “numbers” (STRING) at [1, 103]”
While using mutation returns me “Internal server error”
And “numbers” is the id for the column within the board that I would like to change as an example. The create_item works fine without the column_value input.
FIrst off, it doesn’t seem like you are sending your request with GraphQL Variables, but rather simply inputting the values from your code into the query. Is my understanding correct?
If you are not sending the Item Name as part of your variables, you will also need to properly escape it. Let me know if the following example makes sense;
When wanting to assign multiple users to a People column using the API, you will need to send an array of User IDs, as well as the user kind (team/person). Here’s an example of how this query looks in the GraphQL playground: