Skip to main content

Hi. I’d appreciate any advice on the error response I am receiving from GraphQL. I am trying to update a date column using the mutation “change_simple_column_value”. Here is the error I am getting:


{{  "error_code": "ColumnValueException",  "status_code": 200,  "error_message": "invalid value, please check our API documentation for the correct data structure for this column. https://developer.monday.com/api-reference/docs/change-column-values",  "error_data": {    "column_value": "{\\"date\\"=>\\"\\\\\\"2019-06-03\\", \\"time\\"=>\\"13:25:00\\\\\\"\\"}",    "column_type": "DateColumn"  }}}

This is the string I am sending:


string dt = "2019-06-03 13:25:00";
string value = @"\\\\\\""" + dt + @"\\\\\\""";
string query = "{\\"query\\" : \\"mutation { change_simple_column_value(board_id: " + boardId + ", item_id: " + itemId + " , column_id: \\\\\\"" + columnId + "\\\\\\", value: \\\\\\"" + value + "\\\\\\") { id } }\\"}";

This works in the Monday.com “API Playground”. I think that there is an issue with the date format, but nothing I try works. Other column type updates work without issue. Thanks for any help!

Hello there @ianestu and welcome to the community!


I hope you like it here 💪


I am not experienced with Python but I created this example from our Postman examples for you (Exporting to Python):


import http.client

import json

conn = http.client.HTTPSConnection("api.monday.com")

payload = json.dumps({

"query": "mutation {change_multiple_column_values(item_id:11111, board_id:22222, column_values: \\"{\\\\\\"date\\\\\\" : {\\\\\\"date\\\\\\" : \\\\\\"1993-08-27\\\\\\", \\\\\\"time\\\\\\" : \\\\\\"18:00:00\\\\\\"}}\\") {id}}"

})

headers = {

'Authorization': 'RELEVANT_API_KEY',

'Content-Type': 'application/json'

}

conn.request("POST", "/v2", payload, headers)

res = conn.getresponse()

data = res.read()

print(data.decode("utf-8"))

What happens if you try something like this?


Looking forward to hearing from you 🙂


Cheers,

Matias


Hi, @Matias.Monday. I am working with C#, not Python. Can you please provide an example that updates a date column value using C#?


It seems to me that the change_simple_column_value endpoint that I describe above is recognizing the column, but not the format. Is there any insight that you can provide on what I am doing wrong there?


Thanks again!


Hello again,


Sorry about that! My bad.


Here is the Postman example exported to C#:


var client = new HttpClient();

var request = new HttpRequestMessage(HttpMethod.Post, "https://api.monday.com/v2");

request.Headers.Add("Authorization", "RELEVANT_API_KEY");

var content = new StringContent("{\\n \\"query\\": \\"mutation {change_multiple_column_values(item_id:11111, board_id:22222, column_values: \\\\\\"{\\\\\\\\\\\\\\"date\\\\\\\\\\\\\\" : {\\\\\\\\\\\\\\"date\\\\\\\\\\\\\\" : \\\\\\\\\\\\\\"1993-08-27\\\\\\\\\\\\\\", \\\\\\\\\\\\\\"time\\\\\\\\\\\\\\" : \\\\\\\\\\\\\\"18:00:00\\\\\\\\\\\\\\"}}\\\\\\") {id}}\\" \\n}", null, "application/json");

request.Content = content;

var response = await client.SendAsync(request);

response.EnsureSuccessStatusCode();

Console.WriteLine(await response.Content.ReadAsStringAsync());

Looks to me like the issue may be related to how quotes are being escaped.


Please let me know how this goes!


Cheers,

Matias


Hi, I was able to successfully update a column using “change_multiple_column_values” from the example provided. Thank you @Matias.Monday .


Happy to help @ianestu !!


Reply