Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

ConnectWise API Base Path Change #9

@sgtoj

Description

@sgtoj

ConnectWise API's base path can and will change. Furthermore, CW Manage partners may be on different codebase (even if it cloud hosted). Therefore, the best practice is to build the basePath after retrieving the Codebase. This can be queried via https://{host}/login/companyinfo/{company-name}.

Acme Corporation (Fake) Example

let company = "acmecorp";
let host = "api-na.myconnectwise.net";

// get request: `https://api-na.myconnectwise.net/login/companyinfo/acmecorp`
let info = getCWManageCompanyInfo(host, company)
console.log(info);  
// > {  
// >    "CompanyName":"Acme Corporation",
// >    "Codebase":"v2017_6/",  <---------------- this is a legit codebase
// >    "VersionCode":"v2017.6",
// >    "VersionNumber":"v4.6.50810",
// >    "CompanyID":"acmecorp",
// >    "IsCloud":true,
// >    "SiteUrl":"api-na.myconnectwise.net",
// >    "LicenseBits":{
// >    }
// > }

let basePath = `https://${host}/${info.Codebase}apis/3.0`;
console.log(basePath);
// > https://api-na.myconnectwise.net/v2017_6/apis/3.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions