Get Company Hubs


Static Host Value

    
            static string _host = "https://astuteincservices.com";
        
    

A method named LogMeIn() returns an instance of DGLogInRequest with your credentials.


C# HTTP

        
            static void GetUserTitles(string token)
            {
                HttpClient apiClient = new HttpClient();
                string route = "/api/admin/title-values";

                var json = JsonConvert.SerializeObject(LogMeIn());
                var strContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json");
                apiClient.DefaultRequestHeaders.Clear();
                apiClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);

                var response = apiClient.PostAsync(_host + route, strContent).Result;

                if (response.StatusCode == System.Net.HttpStatusCode.OK) 
                {
                    var titles = response.Content.ReadAsStringAsync().Result;
                }
                else
                {
                    Console.WriteLine($"{response.Content.ReadAsStringAsync().Result} - Not authorized");
                }
            }
        
    

C# Flurl

    
            static void GetUserTitles(string token)
            {
                var response = _host.AppendPathSegment("/api/admin/title-values").WithOAuthBearerToken(token).PostJsonAsync(LogMeIn()).Result;

                if (response.StatusCode == System.Net.HttpStatusCode.OK)
                {
                    var titles = response.Content.ReadAsStringAsync().Result;
                }
                else
                {
                    Console.WriteLine($"{response.Content.ReadAsStringAsync().Result} - Not authorized");
                }
            }