Skip to main content

Monday.com API call from C# Code

  • August 24, 2022
  • 4 replies
  • 1387 views

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();
    }

4 replies

  • August 25, 2022

Hi @knpashish!

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


  • Author
  • Participating Frequently
  • August 25, 2022

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:


Matias.Monday
Forum|alt.badge.img
  • monday.com Team Member
  • August 25, 2022

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?

  • Author
  • Participating Frequently
  • September 13, 2022

Thanks i got it now its work