2

In my application , I am going to use connectwise API , but I can't figure out how to call their API, like

  1. API end point
  2. How to pass header
  3. How to authentication (I have company id , public and private key)
  4. How to make call and take response
  5. I am PHP guy

Thanks in advance for any help !!

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Subrata
  • 175
  • 1
  • 2
  • 15

1 Answers1

5

ConnectWise has a developer portal that is very helpful for this stuff: developer.connectwise.com. If you don't have a login, create a ticket with them to give you access.

Here are basic answers to your questions, though:

  1. The endpoint prefix is this: https://[connectwise_server]/v4_6_release/apis/3.0/ and then you add to the end depending on the resource you're querying
  2. I believe the only headers you need are Content-Type: application/json and the authentication header (see below)
  3. Authentication is BASIC auth. In PHP, that would look something like this.

    $username = $companyId .'+'. $publicKey;
    $password = $privateKey;
    curl_setopt($process, CURLOPT_USERPWD, $username . ":" . $password);
    
  4. A quick search of SO produced this starting point: Call a REST API in PHP

  5. I used to be one of those, too.
Community
  • 1
  • 1
SpaDusA
  • 324
  • 4
  • 14
  • Hi, thanks for your information . can you help me that how do I get [connectwise_server] . because I have been provided only company id , public key and private key. Api endpoint is static url except [connectwise_server]. will it be fixed http://api-na.myconnectwise .. like this ? – Subrata Sep 08 '16 at 07:01
  • If you have a premise installation, [connectwise_server] will be the URL to that server. If you're a cloud client, then the one you reference is correct: api-na.myconnectwise.com. So if you wanted to query the Company API for a Company with id 1, you would submit a GET request to https://api-na.myconnectwise.com/v4_6_release/apis/3.0/company/companies/1 – SpaDusA Sep 08 '16 at 14:20
  • Actually for the ConnectWise cloud solution the API url is `https://api-na.myconnectwise.net/`. Basically .net vs .com – webworm Feb 15 '18 at 20:29
  • Hi All, I'm also have one doubt in Connectwise. Any chance to differentiate our account is in premise or cloud type using host,public and Private key through API. – Raja C Sep 07 '18 at 06:57