I need to pull all board names using c#

Greetings everyone!
I’m very new to Monday.com and GraphQL api system.
My only requirement is to pull “All board names” available on my monday.com
using c#, so I can eventually show them in a dropdown of my web application.

I found this c# code on the forum but it is not working.

I’ve generated the authentication token already, I just don’t know how to write query to pull

public class MondayHelper
        private const string MondayApiKey = "YourKey";
        private const string MondayApiUrl = "https://api.monday.com/v2/";

        /// <summary>
        /// Get a JSON response from the Monday.com V2 API.
        /// </summary>
        /// <param name="query">GraphQL Query to apply to the Monday.com production instance for Grange.</param>
        /// <returns>JSON response of query results.</returns>
        /// <remarks>
        /// Query must be in JSON,
        ///		e.g. = "{\"query\": \"{boards(ids: 1234) {id name}}\"}"
        /// </remarks>
        public async Task<string> QueryMondayApiV2(string query)
            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 @shaikhnoman.nasir, welcome to the community!

It looks like for C# you will need to write your query in JSON. Have you ever done this before?

If not, I would definitely check out some resources online. I also found this super helpful thread that my colleague solved: How to format the JSON string to match the "try-it-yourself" query I've made? API v2 - #2 by Alex.M.

Does this help at all? If not, feel free to DM me with more details about your request.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.