using System;
namespace TimeLiveAPISample
{
    class Program
    {
        static void Main(string[] args)
        {
            const string URL = "http://demo.livetecs.com/api/departments";
            try
            {
                var webRequest = System.Net.WebRequest.CreateHttp(URL);
                if (webRequest != null)
                {
                    webRequest.Method = "GET";
                    webRequest.UserAgent = "C# TimeLive API Sample";
                    webRequest.Headers.Add("AuthToken", <TIMELIVE_AUTHENTICATION_TOKEN>);
                    webRequest.Headers.Add("APIKey", <TIMELIVE_API_KEY>);
                    using (System.IO.Stream s = webRequest.GetResponse().GetResponseStream())
                    {
                        using (System.IO.StreamReader sr = new System.IO.StreamReader(s))
                        {
                            var jsonResponse = sr.ReadToEnd();
                            Console.WriteLine(jsonResponse);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }            
        }
    }
}