ConnectWise.Http
1.0.4
See the version list below for details.
dotnet add package ConnectWise.Http --version 1.0.4
NuGet\Install-Package ConnectWise.Http -Version 1.0.4
<PackageReference Include="ConnectWise.Http" Version="1.0.4" />
paket add ConnectWise.Http --version 1.0.4
#r "nuget: ConnectWise.Http, 1.0.4"
// Install ConnectWise.Http as a Cake Addin #addin nuget:?package=ConnectWise.Http&version=1.0.4 // Install ConnectWise.Http as a Cake Tool #tool nuget:?package=ConnectWise.Http&version=1.0.4
ConnectWise.Http
A .Net HttpClient wrapper for interacting with the ConnectWise Manage REST API.
Installation
NuGet PM> Install-Package ConnectWise.Http
Usage
Client Setup
using ConnectWise.Http;
// Create Settings
var settings = new CWApiSettings(
"https://cw.siteurl.com",
"companyName",
new MemberAuthSettings("publicKey", "privateKey")
);
// Create HTTP Client
var client = new CWHttpClient(settings);
GET Request
using ConnectWise.Http.Modules.Service;
// Build & Send Request
int ticketId = 121;
var request = ServiceModule.Tickets.GetRequest(ticketId);
var response = await client.SendAsync(request);
POST/PUT Request
You serialize the body content before building the request.
// Build & Send Request
string serializedContent = JsonConvert.SerializeObject(...);
var request = ServiceModule.Tickets.CreateRequest(serializedContent);
var response = await client.SendAsync(request);
PATCH Request
ConnectWise.Http provides a ConnectWise Patch Operation object as per their REST developer documentation.
// List Patch Operations
var operations = new List<CWPatch>();
operations.Add(new CWPatch {
Op = CWPatchOperation.Replace,
Path = "status/name",
Value = "Closed"
});
// Build & Send Request
int ticketId = 121;
var request = ServiceModule.Tickets.UpdateRequest(ticketId, operations);
var response = await client.SendAsync(request);
Deserialization
ConnectWise.Http can also attempt to deserialize the response into your provided type.
// Where "TConnectWiseTicket" is your custom type.
int ticketId = 121;
TConnectWiseTicket ticket = null;
var request = ServiceModule.Tickets.GetRequest(ticketId);
var response = await client.SendAsync<TConnectWiseTicket>(request);
if (response.IsSuccessful && response.IsDeserialized) ticket = response.Data;
Modules
Below are the modules currently implemented. You can use the CWRequest object to specify specific endpoints not yet supported here - These serve only to simplify the creation of the request URI.
Modules | Supported |
---|---|
Company | Partial |
Expense | No |
Finance | No |
Marketing | No |
Procurement | No |
Project | Yes |
Sales | No |
Schedule | Yes |
Service | Yes |
System | No |
Time | Yes |
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net461 is compatible. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- Newtonsoft.Json (>= 11.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.1.1 | 22,321 | 8/22/2019 |
1.1.0 | 1,487 | 7/14/2019 |
1.0.9 | 2,567 | 10/1/2018 |
1.0.8 | 1,905 | 5/24/2018 |
1.0.7 | 1,817 | 5/24/2018 |
1.0.6 | 1,807 | 5/22/2018 |
1.0.5 | 1,889 | 4/30/2018 |
1.0.4 | 1,967 | 4/27/2018 |
1.0.3 | 1,772 | 4/26/2018 |
1.0.2 | 2,160 | 12/10/2017 |
1.0.0.1 | 1,821 | 11/22/2017 |
1.0.0 | 1,902 | 11/22/2017 |
Resolved "IsDerialized" Typo on CWResponse and added minor functionality for standard endpoints to serialize content within ConnectWise.Http