Hey @Jaap-CAD2M 👋
That’s a great question! Since the query works in the online environment you’ve mentioned, I’m wondering if this might be related to the way you are sending the values?
Based on the query you’ve provided, I’m wondering if:
- There might be an issue with the IDs you are using. I would recommend checking the Item, Board and column IDs;
- There is an issue with the formatting of the request. When sending a mutation to our GraphQL API, it must be formatted as a JSON string, and the column values will need to be escaped further in the JSON;
- You will also need to specify that you are sending a query to the API, and then declare it is a mutation;
- Please make sure you are using
"
as the quote symbol;
Here’s a Postman request that updates a Link column value
Here is the query itself:
{"query" : "mutation { change_column_value (board_id: 589795234, item_id: 589795238, column_id: \\"link\\", value: \\"{\\\\\\"url\\\\\\":\\\\\\"https://url.web.com/index.php?module=Quotes&view=Detail&record=662840\\\\\\",\\\\\\"text\\\\\\":\\\\\\"QUO07313\\\\\\"} \\") {id }}"}
Here is a cURL code example too:
curl --location --request POST 'https://api.monday.com/v2' \\
--header 'Authorization: YourApiKey' \\
--header 'Content-Type: application/json' \\
--data-raw '{"query" : "mutation { change_column_value (board_id: 589795234, item_id: 589795238, column_id: \\"link\\", value: \\"{\\\\\\"url\\\\\\":\\\\\\"https://url.web.com/index.php?module=Quotes&view=Detail&record=662840\\\\\\",\\\\\\"text\\\\\\":\\\\\\"QUO07313\\\\\\"} \\") {id }}"}'
-Alex
It’s working. I was staring blind on the possibility of a cascading update, but the problem was much simpler: I had a wrong variable that I passed to the monday client 😦
Final working code:
const mutation = `mutation changeValue ($board_id: Int!, $item_id: Int!, $column_id: String!, $value: JSON!) {
change_column_value (board_id: $board_id, item_id: $item_id, column_id: $column_id, value: $value) {
id
}
}`;
const variables = { board_id: parseInt (itemDetails.board.id), item_id: parseInt(itemDetails.id), column_id: COL_QUOTE, value: JSON.stringify (linkValue) };
const response = await mondayClient.api(mutation, { variables });
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.