title: Using C# to connect to ConnectWise API
body: <p>I intend to create a program using C# which will update tickets in ConnectWise using, eventually, data from another API. </p>
  
  <p>Thus far I've wanted to test to <code>GET</code> some invoices. For this I installed the latest SDK and referenced it in Visual studio (SDK 2017.3). </p>
  
  <p>The documentation claims that this should suffice:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using ConnectWiseDotNetSDK;
  using ConnectWiseDotNetSDK.ConnectWise;
  using ConnectWiseDotNetSDK.ConnectWise.Client;
  using ConnectWiseDotNetSDK.ConnectWise.Client.System.Api;
  using ConnectWiseDotNetSDK.ConnectWise.Client.System.Model;
  
  private static List&lt;Invoice&gt; getInvoices()
  {
      var client = getApiClient();
      var invoicesApi = new InvoiceApi(client);
      var response = invoicesApi.GetInvoices();
      var invoices = response.GetResult&lt;List&lt;Invoice&gt;&gt;();
      foreach (var invoice in invoices)
      {
          Console.WriteLine(invoice);
      }
      return invoices;
  }
  </code></pre>
  
  <p>(where I have added all the <code>using ....</code> rows, the documentation does not clarify which are needed). </p>
  
  <p>This however gives me an error that <code>getApiClient() does not exist in this context</code>. I reckon I must create the function, which will provide my authentication etc. Thus I've done:</p>
  
  <pre><code>private static getApiClient()
  {
      string BaseUri = "https://eu-myconnectwise.net/v4_6_Release/apis/3.0/finance/invoices"
      string ContentType = "application/json";
      string Authstring = "xxxxyyxxxx";
  }
  </code></pre>
  
  <p>This does not work. I have no idea how to create the <code>client</code> variable in the main program. </p>
  
  <p>Has anyone gotten the SDK to work using C#? </p>