Monday.com API call from C# Code

Hi Team,
we are trying to create item with column values in Monday.com board from C# code but item is not created please suggest where we are missing
string columnvalue = “ready 5”;

string query = @“{ ““query””: ““mutation {create_item(board_id: 3133804748,item_name: new item test10, column_values:"”{\"“text\"”:\"”” + columnvalue + @“\"”}"“) { id} }”" }";
string MondayApiKey = “Token”;
string MondayApiUrl = “https://api.monday.com/v2/”;
byte dataBytes = System.Text.Encoding.UTF8.GetBytes(query);

    HttpWebRequest request = (HttpWebRequest)WebRequest.Create(MondayApiUrl);
    request.ContentType = "application/json";
    request.Method = "POST";
    request.Headers.Add("Authorization", MondayApiKey);

    using (Stream requestBody = request.GetRequestStream())
    {
        await requestBody.WriteAsync(dataBytes, 0, dataBytes.Length);
    }

    using (HttpWebResponse response = (HttpWebResponse)await request.GetResponseAsync())
    using (Stream stream = response.GetResponseStream())
    using (StreamReader reader = new StreamReader(stream))
    {
        return await reader.ReadToEndAsync();
    }

Hi @knpashish!

Could you please share the error you are seeing when trying to create an item?

Hi @alessandra ,
Thanks for your response , when i am trying to ItemValue with two text Colum value but its save only first column (text) value in monday board but not for second column (Text1) .
My query as below:
string query = @“{ ““query””: ““mutation {create_item(board_id: 3136520113,item_name: "“new item test12"”, column_values:"”{\"“text\"”:\"“TextItem \"”,\"“text1\"”:\"“TextOneItem \"”}"”) { id} }”" }";

By Board structure below:

Hello there @knpashish!

I have two questions:

  1. Which response do you get from our server when you send the HTTP request?
  2. Are you sure the ID of the second text column is text1 and not something like text_1?

Thanks i got it now its work

1 Like