UptimeRobotDotnet 1.0.4
See the version list below for details.
dotnet add package UptimeRobotDotnet --version 1.0.4
NuGet\Install-Package UptimeRobotDotnet -Version 1.0.4
<PackageReference Include="UptimeRobotDotnet" Version="1.0.4" />
paket add UptimeRobotDotnet --version 1.0.4
#r "nuget: UptimeRobotDotnet, 1.0.4"
// Install UptimeRobotDotnet as a Cake Addin #addin nuget:?package=UptimeRobotDotnet&version=1.0.4 // Install UptimeRobotDotnet as a Cake Tool #tool nuget:?package=UptimeRobotDotnet&version=1.0.4
uptimerobot-dotnet
A simple UptimeRobot .NET Client
Nuget.org Link: https://www.nuget.org/packages/UptimeRobotDotnet
API Documentation: https://uptimerobot.com/api/
Notes
- This client is a simple wrapper around the UptimeRobot API. It does not implement all the API endpoints.
- The client uses the Newtonsoft.Json library to serialize and deserialize JSON data.
- The client is asynchronous and uses the HttpClient class to make HTTP requests.
- The HttpClient is implemented per Micrsoft recommendations. In this case, a Singleton that is reused.
- You may provide your own HttpClient instance if you want to manage the lifecycle of the HttpClient.
- Manual tests are provided if you'd like to observe the client in action. You will need to provide your own API key.
State
Entity | Implemented |
---|---|
Alert Contacts | ❌ |
Maintenance Windows | ❌ |
Monitors | ✅ |
Status Pages | ❌ |
Caveats
- The UTR API limits max results to 50. This client does not handle pagination. You will need to manage this yourself using Offset.
- The UTR API implementation only supports POST requests (99.9%), so the client API surface may not be ideal.
- The UTR API requires the API Key to be passed in each POST body, so the client API surface may not be ideal.
- The client will automatically inject the API Key into the payload from the active client, but you can set it manually as well.
Usage
Example usage using Monitors. Implementation across entities is similar. Though some entities may not support all methods.
Use manual tests for reference.
Get all monitors
https://uptimerobot.com/api/#getMonitorsWrap
var client = UptimeRobotClientFactory.Create("YOUR-API-KEY-HERE");
var monitors = await client.Monitors(); // A MonitorSearchParameters object can be passed to filter results
Get monitor by Id
var client = UptimeRobotClientFactory.Create("YOUR-API-KEY-HERE");
var parameters = new MonitorSearchParameters() { Monitors = "EXISTING-MONITOR-ID" };
var monitor = await client.Monitor(parameters);
Create a monitor
https://uptimerobot.com/api/#newMonitorWrap
Example: Create a monitor for https://your-url-here.com
var client = UptimeRobotClientFactory.Create("YOUR-API-KEY-HERE");
var parameters = new MonitorParameters
{
FriendlyName = "Your Monitor Name", // Required
Type = 1, // Required
Url = "https://your-url-here.com", // Required
};
var create = await client.MonitorCreate(parameters);
Update a monitor
https://uptimerobot.com/api/#editMonitorWrap
Example: Update the monitor interval to 300 seconds
var client = UptimeRobotClientFactory.Create("YOUR-API-KEY-HERE");
var updateParameters = new MonitorParameters
{
Id = "EXISTING-MONITOR-ID", // Required
Interval = 300
};
var update = await client.MonitorUpdate(updateParameters);
Delete a monitor
https://uptimerobot.com/api/#deleteMonitorWrap
var deleteParameters = new MonitorDeleteParameters
{
Id = "EXISTING-MONITOR-ID" // Required
};
var client = UptimeRobotClientFactory.Create("YOUR-API-KEY-HERE");
var delete = await client.MonitorDelete(deleteParameters);
Contributing
Use your favorite IDE to open the project. The project was developed using Visual Studio.
git clone https://github.com/strvmarv/uptimerobot-dotnet.git
cd uptimerobot-dotnet
dotnet restore
dotnet build
Run Tests
dotnet test
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. 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 is compatible. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- System.Text.Json (>= 9.0.0)
-
net6.0
- System.Text.Json (>= 6.0.11)
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
fix typos, fix custom headers, fix updates