Calling items_by_column_values via C#

Hi ,
i am trying to Calling items_by_column_values via C# but its giving error but its running in API playground :
query {
items_by_column_values (board_id: 3216756962, column_id: “text6”, column_value: “db255f1d-c3e6-43ee-8a96-921c5256eda3”) {
id
name
}
}

and my C# string is : {“query”: "items_by_column_values(board_id: 3216756962,column_id: "text6",column_value: "db255f1d-c3e6-43ee-8a96-921c5256eda3") {id} " }

and my code is as below :
public async Task QueryMondayApiV2()
{ string projectCode = “text6”;
string rowguid = “db255f1d-c3e6-43ee-8a96-921c5256eda3”;

    //var query = @"{""query"": ""mutation {create_item(board_id: 3136520113,item_name: \""" + projectCode + @"\"",column_values:\""{\\\""text\\\"":\\\""" + projectName + @"\\\"",\\\""text_14\\\"":\\\""" + Projectdescription + @"\\\""}\"") {id}  }"" }";
    var query = @"{""query"": ""items_by_column_values(board_id: 3216756962,column_id: \""" + projectCode + @"\"",column_value: \""" + rowguid + @"\"") {id} "" }";
    string MondayApiKey = "MondayKey";
    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);
    }

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

Hi when i am trying below string query in my code :
var datapull = @“{”“query”“:”“items_by_column_values(board_id: 3216756962, column_id: ““text6"”, value:”“db255f1d-c3e6-43ee-8a96-921c5256eda3"”){ id}”“}”;
so error message is come : System.Net.ProtocolViolationException: ‘Cannot send a content-body with this verb-type.’

Hello there @knpashish!

If this works at the Playground, this is probably something related to C# syntax.

To be transparent with you, I do not have experience with this language so I can not assist you with it. Let’s hope someone in the community with C# experience can help here :slightly_smiling_face: