Integrating API with c#

Hey, I’m quite new to Monday.com’s API and I’m trying to insert a new item via C#. I’m using the code below, but when I execute it, I’m getting a 404 error. I went through the query part-by-part, and when I modify it to remove the {id} part, the code seems to execute without error, but doesn’t insert any records. I’m guessing the problem is the formatting of the query, but I just can’t seem to identify it. Does anyone have any suggestions?

var query = @"{"“query”": ““mutation {create_item(board_id: ########, group_id: ““test””, item_name: ““John Doe””) { id} }”” }";

    var httpWebRequest = (HttpWebRequest)WebRequest.Create("https://api.monday.com/v2/");
    httpWebRequest.ContentType = "application/json; charset=UTF-8";
    httpWebRequest.Method = "POST";
    httpWebRequest.Headers.Add("Authorization", _apiKey);

    using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
    {
        streamWriter.Write(query);
    }

    var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
    using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
    {
        var result = streamReader.ReadToEnd();
    }

Hey @kliq316 - welcome to the community!

It looks like the issue might be related to the double quotes being used, you’ll want to use something like this:

mutation{create_item(board_id: xxxxx, group_id:"test", item_name:"John Doe") {id}}

I would also recommend double checking the group ID, as this sometimes differs from the name of the group. Let me know if that helps!

-Daniel