Visual Studio VB.Net API v2

I am new to GraphQL. Does anyone know how to set up queries (or have any examples) using visual studio VB.net.

hey @dennis_pappas,
I’ve never used VB.net before but maybe this will help:
You can access our GraphQL API with a POST request with the query in the request body.
The query needs to be set where the identifier is “query” and its value is the actual query, in JSON it would look like this:

body: {
 'query': 'query {
               boards (limit: 1) {
                  id
                  name
               }
            }'
}

The API v2 Token needs to be sent in the Authorization header.

Hope this helps!

I am not sure how to make the post request. I worked on the Monday website on building the actual query, but I am not sure how to set up GraphQL. I see you referring to the authorization in the header in other posts, but I am not sure if I completely understand where the token would go. Does it go in the URL, or is the API object oriented and requires me to define the authorization/set some property?

Hi @dennis_pappas

It’s not VB.NET but I did some work on this in C# quite recently which might be similar to what you need.

I subclassed HttpClient and set the HTTP Authorization header like this -

string apiToken = "YOUR TOKEN HERE";
this.DefaultRequestHeaders.Authorization = System.Net.Http.Headers.AuthenticationHeaderValue.Parse(apiToken);

Then the query can be sent as JSON as the HttpContent (i.e. the request body) of a POST request, like this (where _mondayClient is the subclassed HttpClient) -

StringContent content = new StringContent(YOUR_QUERY_HERE, Encoding.UTF8, "application/json");
using (var response = _mondayClient.PostAsync("", content))
{
    // … process the response as you need
}

It’s far from perfect but I have put a full example on GitHub at https://github.com/LucyParry/MondayAPIV2_BasicExample if it’s useful to anyone. Hope this helps! :smile:

1 Like

Hey @dennis_pappas! Happy to give you more general context in addition to @lucy.parry’s amazing post above.

All requests to our API are simply HTTP POST requests sent to https://api.monday.com/v2. To authenticate your requests, you need to include an “Authorization” value in the header of the request, and this value should be your API key.

The body of the HTTP request should be a JSON formatted string, and the body should contain a “query” value that contains a JSON string of the operation you want to complete. There are no parameters you need to set in the URL, all the relevant data for your queries should be put in the body of the JSON request.

1 Like