Search code examples
restpostman

ConnectWise REST API - getting "Length cannot be less than zero.\r\nParameter name: length"


I am getting:

"Length cannot be less than zero.\r\nParameter name: length"

message while calling the ConnectWise REST service. For example:

https://api-na.myconnectwise.net/v2022_2/apis/3.0/company/companies/

I am passing clientid, Basic base64(companyid+publickey:privatekey) in headers, it appears that the authorization pass (no Unauthorized message) but getting the message:

"Length cannot be less than zero.\r\nParameter name: length"

Please take a look at the attached screen capture of the POSTMAN request.

If I do not use the authorization header but use Authorization > Basic Auth with Username = companyid + Public Key and Passsword = Private Key then I get an Unauthorized message.

ConnectWise docs talk about creating Service Boards and ITSupport Portal. Do we need to create these two and any other setup?

I am provided with clientid, public and private key, and not sure whether Service Boards and ITSupport Portal are created or not.

Hoping to get some insight from you.

enter image description here


Solution

  • While generating the Base64 encoded authentication token, I inadvertently swapped the positions of the "+" and ":" symbols in the format "company_id:public_key+private_key" instead of the correct "company_id+public_key:private_key".

    Please review your authentication token once more.