How to convert Python REST call to c#

Postman was helpful in getting the token via c#, but there’s no example on how to use the token.

Fortunately, I have figured it out since making the original post and below is the full answer. I included the entire class so you can see the usings and these are the NuGet packages needed.

(I’m probably the only person in the TigerGraph world using c#, but incase there’s another out there… here it is.)


using Newtonsoft.Json;
using RestSharp;
using System;

namespace TgRocks
    public class MakeRestCall
        public void StartCall()
            var client = new RestClient("");
            client.Timeout = -1;
            var request = new RestRequest(Method.GET);
            IRestResponse response = client.Execute(request);

            dynamic stuff = JsonConvert.DeserializeObject(response.Content);
            string token = stuff.token;

            RestClient client2 = new RestClient("");
            client2.AddDefaultHeader("Authorization", "Bearer " + token);
            client2.Timeout = -1;
            var request2 = new RestRequest(Method.GET);
            IRestResponse response2 = client2.Execute(request2);



Hi George,

Even if you figured the solution out yourself (:+1:), here are a few things that you might be interested in:

  • There is a complete, fully documented Postman collection available for the REST++ API.
  • The pyTigerGraph package is now almost complete (I will add the two missing path finder algorithms soon), it covers a lot of REST API functionality in a (I hope) user-friendly way.
  • I am not sure if you are the only C# developer interested in TigerGraph, but in this world I do not think anyone is really alone in their interest/hobby/favourite stuff. If you are interested in creating a full C# connector for TigerGraph (same in functionality to pyTigerGraph), I/we would be happy to help (and probably even contribute, although I have never used C# before, but there is always a first time for everything). Let me know if it’s something you would be willing to work on (

Hi Szilard,

Thank you for the pointers and the offer to potentially participate in writing a connector in c# sounds very interesting. I will explore this. We have many years developing frameworks and tools in the MS stack so our quickest path to delivering a solution with TG will be leveraging those and therefore it makes sense to create a c# connector. That being said, we’re also looking into doing something with rust and Web Assembly so that might an opportunity to create yet another connector later on.

1 Like

Hi George,

I would be happy to assist with both C# and Rust connector, but since I am not very familiar with these languages, I would need guidance. I guess if someone showed me an example, I could go on developing the rest of the functions/methods.