ti-sign
(Till)
November 2, 2022, 8:20am
1
Hey there!
I’ve a really bad time wrapping my head around this… I’m trying to change a column value from a post request. It’s formed as follows:
var query = `mutation change_column_value($board_id: Int!, $item_id: Int!, $column_id: String!, $value: String!) {
change_column_value(board_id: $board_id, item_id: $item_id, column_id: $column_id, value: $value)
{id}}`
And these are my variables:
var board_id = 3395274995;
var item_id = req.body.eventId;
var column_id = "text71";
var value = "Test";
And I’m getting this response:
'Type mismatch on variable $value and argument value (String! / JSON!)'
I just don’t get it, column_id is a String and that seems to work perfectly but the value throws an error. The field is a simple text field, so it should be of type String or am I missing something?
basdebruin
(Bas de Bruin)
November 2, 2022, 10:07am
2
Except the the value needs to be stringified
ti-sign
(Till)
November 2, 2022, 10:15am
3
Thanks again for your support Bas
here is where I get stuck… This request works fine:
{"query":"mutation{ change_column_value (item_id: 3395473805, board_id: 3395274995, column_id: \"numbers7\", value: \"2\") { id } }"}
{
This one doesn’t:
{"query":"mutation{ change_column_value (item_id: 3395473805, board_id: 3395274995, column_id: \"text6\", value: \"Test\") { id } }"}
Now, do I need to double escape a text value or what am I missing? How should the text value look like to be accepted?
Thanks again for helping out here!
basdebruin
(Bas de Bruin)
November 2, 2022, 11:01am
4
Please check the API docs for column references at Text and Numbers
Looks like you are mixing Simple strings and JSON formatted strings (these need to be stingified)
1 Like
ti-sign
(Till)
November 2, 2022, 11:45am
5
Uuh, I got it. Yes, I mixed and matched the formatting. For anybody finding this. I’ve adapted the example in the text API docs:
var requestBody = JSON.stringify({
query: "mutation ($myBoardId:Int!, $myItemId:Int!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id }}",
variables: JSON.stringify({
"myBoardId": MY_BOARD_ID,
"myItemId": MY_ITEM_ID,
"myColumnValues": `{\"text64\": \"${MY_TEXT}\"}`
})
Thanks a lot Bas, great help!
system
(system)
Closed
November 9, 2022, 11:46am
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.