Connectwise.Services
1.0.1
dotnet add package Connectwise.Services --version 1.0.1
NuGet\Install-Package Connectwise.Services -Version 1.0.1
<PackageReference Include="Connectwise.Services" Version="1.0.1" />
<PackageVersion Include="Connectwise.Services" Version="1.0.1" />
<PackageReference Include="Connectwise.Services" />
paket add Connectwise.Services --version 1.0.1
#r "nuget: Connectwise.Services, 1.0.1"
#:package Connectwise.Services@1.0.1
#addin nuget:?package=Connectwise.Services&version=1.0.1
#tool nuget:?package=Connectwise.Services&version=1.0.1
dotnet add package Connectwise.Services --version 1.0.0
Connectwise.Services
Connectwise.Services provides integration helpers and service implementations for interacting with ConnectWise APIs. It is built as part of the Integrations2.0 solution and packaged as a NuGet library for consumption by other projects inside your organization.
Package
- Package ID:
Connectwise.Services - Version:
1.0.0(update in the project file before publishing new releases) - Target framework: .NET 6 (net6.0)
Install
Install from a local feed or nuget.org (example):
dotnet add package Connectwise.Services --version 1.0.0
Or reference the generated local nupkg:
dotnet add package "..\nupkgs\Connectwise.Services.1.0.0.nupkg"
Configuration
This library typically requires ConnectWise connection settings. A common configuration pattern is to use appsettings.json and bind to an options class. Example keys used by consumers in this repo include (adjust names to match the implementation you use):
"Connectwise": {
"BaseUrl": "https://api.connectwise.com/v4_6_release/apis/3.0",
"CompanyId": "yourCompany",
"PublicKey": "public_key_here",
"PrivateKey": "private_key_here",
"TimeoutSeconds": 30
}
Secure your API credentials — don't commit keys to source control. Use user secrets, environment variables or pipeline secrets in CI.
Usage (examples)
The project exposes service classes (see the repository for exact class and interface names). You can consume the package via dependency injection or by creating instances directly.
DI registration pattern (example):
// in Startup.cs or Program.cs
services.AddHttpClient();
// Register the concrete service from this package. Replace the interface/type names with the
// actual public types found in the repository.
services.AddTransient<Connectwise.Services.V2_1.ConnectwiseManageService>();
Usage (resolution):
var svc = serviceProvider.GetRequiredService<Connectwise.Services.V2_1.ConnectwiseManageService>();
// Call methods on the service (see repository for method signatures)
// var ticket = await svc.GetTicketAsync(ticketId);
For specific API calls and method signatures, refer to the source files in
Service/Connectwise.Services/ (V2_0 and V2_1 folders contain implementations used by the solution).
Package contents
- Connectwise.Services.dll
- README.md (this file) — included in the nupkg
- Project XML docs if you generate them during build
Building from source
To build and pack locally:
> dotnet pack "Service\Connectwise.Services\Connectwise.Services.csproj" -c Release -o "nupkgs"
Troubleshooting & notes
- The project targets .NET 6. Ensure your consumer targets a compatible framework.
- During packing you may see vulnerability warnings for transitive dependencies; review the advisories and update dependent packages where appropriate.
- If the package consumer needs XML docs for IntelliSense, enable XML documentation generation in the project file.
Contributing and support
See the main repository: https://github.com/jeffreywilesneweratech-hash/Integrations2.0 Open issues or PRs against that repo if you need changes to the public surface or bug fixes.
License
Refer to the repository license file for license and copyright details.
If you'd like, I can: the code and add a short API reference), Tell me which one you want next.
API Reference
This section lists the primary public types and the main methods available in this package. For full
signatures and overloads, consult the source files in Service/Connectwise.Services.
IConnectwiseManageService
Defined in: Interfaces/IConnectwiseManageService.cs
Public methods (signatures):
- Task<Ticket> CreateConnectwiseTicket(int boardId, int boardStatusId, int companyId, int siteId, int boardTypeId, int boardSubtypeId, int? sourceId, string summary, string initialDescription)
- Task<ServiceNote> CreateGenericConnectwiseServiceNote(int ticketId, ServiceNote note)
- Task<List<BoardStatus>> GetConnectwiseBoardStatuses(int boardId)
- Task<string> GetConnectwiseCompanyCode(int companyId)
- Task<ConnectwiseServiceNotesTicket> GetConnectwiseServiceNotesTicket(int ticketId)
- Task UpdateConnectwiseTicket(int ticketId, List<CWPatch> ticketPatches)
- Task<CWResponse> HandleConnectwiseRequest(CWRequest cwRequest)
- Task<List<ConnectWiseDotNetSDK.ConnectWise.Client.System.Model.DocumentInfo>> GetTicketDocuments(int ticketNo)
- Task UploadDocument(List<ConnectWiseDotNetSDK.ConnectWise.Client.System.Model.DocumentInfo> docs, string sqlCon, string incidentNumber)
- Task<byte[]> DownloadDocument(int DocId)
ConnectwiseManageService (implementation)
Defined in: ConnectwiseManageService.cs
Implements IConnectwiseManageService and exposes the methods above. It depends on:
- IHttpClientFactory
- IConfiguration
- ILogger<IConnectwiseManageService>
- IIntegrationDataRepository
Models
- ConnectwiseCustomFieldsTicket(Ticket ticket, List<CustomFieldValue> customFields)
- Properties: Ticket (Ticket), CustomFields (List<CustomFieldValue>)
- ConnectwiseServiceNotesTicket(ConnectwiseCustomFieldsTicket, List<ServiceNote> serviceNotes, List<TimeEntry> timeEntries)
- Properties: ServiceNotes (List<ServiceNote>), TimeEntries (List<TimeEntry>)
- CWApiCreateResult
- Properties: Id (int), IsSuccess (bool), ErrorMessage (string)
- CWAttachments
- Properties: DeliverableFile (byte[]), FileName, FileType, DocumentIndex, LinkType, LinkValue, UserID, KBGroup, isPostNote
- CWDocuments
- Json-mapped properties: Id, Title, FileName, ServerFileName, Owner, LinkFlag, ImageFlag, PublicFlag, HtmlTemplateFlag, ReadOnlyFlag, Size
- CWPatchFlexible : CWPatch
- Adds
new object Value { get; set; }to allow flexible patch values
- Adds
- CwPriorityMap
- PriorityId, PriorityName, UrgencyId, ImpactId
- CWStatusMap
- ClientStatusId, StatusId, StatusName
Note: Some helper/static types exist (for example CWAPIClient) and may contain configuration constants.
Changelog & Release notes
The repository contains a changelog and a release notes template to make releases consistent.
See CHANGELOG.md and RELEASE_NOTES.md in the project folder for the templates.
CI: Azure Pipelines (pack & publish)
The repository's azure-pipelines.yml has been updated with an optional Publish stage that will:
- Build the solution
- Pack the
Service\Connectwise.Servicesproject - Push the produced nupkg to nuget.org using a pipeline secret
NUGET_API_KEY
Important: Do NOT store API keys in the YAML. Add a pipeline variable named NUGET_API_KEY (secret) in Azure DevOps project pipeline settings.
If you'd like, I can also add a separate pipeline file dedicated to package publishing (e.g. azure-pipelines.publish.yml) and wire it to run on tags only.
Environment variables and secrets
This project reads ConnectWise configuration and credentials from environment variables to avoid committing secrets into source control. Set these variables in your local environment, CI pipeline variables (marked secret), or a secrets store:
- CW_SITE: ConnectWise host (e.g. api-na.myconnectwise.net)
- CW_CODEBASE: codebase path (default: v4_6_release/)
- CW_COMPANY: company identifier used in auth (e.g. commworks)
- CW_PUBLIC_KEY: ConnectWise public API key (secret)
- CW_PRIVATE_KEY: ConnectWise private API key (secret)
- CW_CLIENT_ID: clientId header value (recommended to set)
- CW_CONNECTWISE_VERSION: Accept header version (default: 2019.3)
In Azure Pipelines, add each secret under pipeline Variables and mark them as secret. For publishing to NuGet.org, add NUGET_API_KEY as a secret variable.
Examples: common methods
Below are short examples showing common usage patterns for the main methods on IConnectwiseManageService.
Note: Replace type namespaces and injection code with the exact types from your consuming project.
Create a ticket
// Resolve via DI
var svc = serviceProvider.GetRequiredService<IConnectwiseManageService>();
var created = await svc.CreateConnectwiseTicket(
boardId: 12,
boardStatusId: 3,
companyId: 42,
siteId: 7,
boardTypeId: 2,
boardSubtypeId: 1,
sourceId: null,
summary: "Example issue",
initialDescription: "Created from automated process"
);
Console.WriteLine($"Created ticket id: {created.Id}");
Add a service note to a ticket
var note = new ServiceNote {
DetailDescriptionFlag = true,
Notes = "Work performed: ...",
InternalAnalysisFlag = false
};
var createdNote = await svc.CreateGenericConnectwiseServiceNote(ticketId: 12345, note: note);
Retrieve service notes + time entries for a ticket
var mega = await svc.GetConnectwiseServiceNotesTicket(ticketId: 12345);
foreach (var n in mega.ServiceNotes) Console.WriteLine(n.Notes);
foreach (var t in mega.TimeEntries) Console.WriteLine(t.Notes);
Securing credentials found in repository
I replaced hard-coded ConnectWise values in Models/CWAPIClient.cs with environment-variable lookups.
Please rotate any keys that were previously committed and remove them from source control history where
practical (for example, rotate the keys in ConnectWise and update consumers to use the new values).
If you want, I can:
- add a small helper to read values from Azure Key Vault,
- update consuming code to prefer injected IConfiguration/IOptions over static access, or
- remove remaining occurrences of secrets by scanning the repo and opening PR edits.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- AutoMapper (>= 10.0.0)
- Commworks.Utility (>= 1.0.0)
- Commworks.Utility.Constants (>= 1.0.0)
- ConnectWise.Dtos (>= 1.0.0)
- ConnectWise.Http (>= 1.1.1)
- Dapper (>= 2.0.123)
- Integration.Services (>= 1.0.0)
- IntegrationData (>= 1.0.0)
- IntegrationUtilities (>= 1.0.1)
- Microsoft.Azure.ServiceBus (>= 4.1.3)
- Microsoft.Extensions.Configuration.Abstractions (>= 3.1.8)
- Microsoft.Extensions.Http (>= 3.1.8)
- Microsoft.Extensions.Logging.Abstractions (>= 3.1.8)
- NewEraConnectwiseManager (>= 1.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.