mbalazs
(Michael)
May 7, 2022, 12:13pm
1
Hello!
I am running what I believe to be a simple mutation and I cannot get it to work, I keep getting { “error_message”: “Internal server error”, “status_code”: 500 }. I have tried both the change_multiple_column_values and change_column_value approaches. Searching the forums, I have seen folks say this can be caused by a malformed request string but I am unable to see that. Help is appreciated.
mutation {
change_multiple_column_values(
board_id: 2588471113,
item_id: 2643558945,
column_values: "{\"connect_boards30\":{\"item_ids\":\"2643558944\"}}"
) {
id
}
}
This is generated programmatically from this:
let mutation = `mutation {
change_multiple_column_values(
board_id: 2588471113,
item_id: ${createdSubItemId},
column_values: ${JSON.stringify(updatedColumnValues)}
) {
id
}
}`
Of note:
My board_id references a sub_items board if that makes a difference.
I have tried the query both in my code and directly on the Monday.com API playground.
Thanks!
Michael
hi @mbalazs
Welcome to the community! It looks like your value is wrong, try this one:
mutation {
change_column_value(board_id: 2588471113, item_id: 2643558945, column_id:"connect_boards30", value: "{\"linkedPulseIds\":[{\"linkedPulseId\":2643558944}]}") {
id
}
}
And do not escape integer values (only strings).
mbalazs
(Michael)
May 8, 2022, 12:27am
3
Awesome thanks! That did it. I had tried to follow what I saw here .
mbalazs
(Michael)
May 8, 2022, 3:33am
4
Following up, when I try in nodejs I get the following…
{
errors: [
{
message: 'Parse error on ":[{" (STRING) at [5, 28]',
locations: [Array]
}
],
account_id: 11715703
}
…running this code…
let mutation = `mutation {
change_column_value(board_id: 2588471113,
item_id: 2643558945,
column_id: "connect_boards30",
value: "{\"linkedPulseIds\":[{\"linkedPulseId\":2643558944}]}") {
id
}
}`
console.log(mutation);
monday.api(mutation).then(res => {
if (Object.keys(res).includes("errors")) {
console.log(res)
}
})
mbalazs
(Michael)
May 9, 2022, 1:14am
5
For future note, I found this worked:
let x = {
"linkedPulseIds": [{
"linkedPulseId": 2643558944
}]
}
let mutation = `mutation {
change_column_value(board_id: 2588471113,
item_id: 2643558945,
column_id: "connect_boards30",
value: ${JSON.stringify(JSON.stringify(x))}) {
id
}
}
Got it from here: Parsing Error: No error on playground, error in JavaScript