UpdownDotnet 1.1.0
dotnet add package UpdownDotnet --version 1.1.0
NuGet\Install-Package UpdownDotnet -Version 1.1.0
<PackageReference Include="UpdownDotnet" Version="1.1.0" />
<PackageVersion Include="UpdownDotnet" Version="1.1.0" />
<PackageReference Include="UpdownDotnet" />
paket add UpdownDotnet --version 1.1.0
#r "nuget: UpdownDotnet, 1.1.0"
#:package UpdownDotnet@1.1.0
#addin nuget:?package=UpdownDotnet&version=1.1.0
#tool nuget:?package=UpdownDotnet&version=1.1.0
updown-dotnet
A simple Updown.io .NET Client
https://www.nuget.org/packages/UpdownDotnet
Don't currently utilize Updown.IO? Join here --> https://updown.io/r/WioVu
Notes
- This client is a simple wrapper around the Updown.io API. It does not implement all the API endpoints.
- The client uses the System.Text.Json namespace to serialize and deserialize JSON data.
- The client is asynchronous and uses the HttpClient class to make HTTP requests to the Updown.io API.
- 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 |
---|---|
Checks | ✅ |
Downtimes | ❌ |
Metrics | ❌ |
Nodes | ❌ |
Recipients | ✅ |
Status Pages | ✅ |
Pulse Monitoring | ✅ |
Usage
Example usage using Checks. Implementation across entities is similar. Though some entities may not support all methods.
Use manual tests for reference.
Get all checks
var client = UpdownClientFactory.Create("YOUR-API-KEY-HERE");
var checks = await client.Checks();
Get check by token
var client = UpdownClientFactory.Create("YOUR-API-KEY-HERE");
var check = await client.Check("EXISTING-CHECK-TOKEN");
Create a check
Example: Create a check for https://your-url-here.com
var client = UpdownClientFactory.Create("YOUR-API-KEY-HERE");
var parameters = new CheckParameters
{
Url = "https://your-url-here.com",
};
var check = await client.CheckCreate(parameters);
Update a check
Example: Update the check period to 300 seconds
var client = UpdownClientFactory.Create("YOUR-API-KEY-HERE");
var updateParameters = new CheckParameters
{
Period = 300
};
var update = await client.CheckUpdate("EXISTING-CHECK-TOKEN", updateParameters);
Delete a check
var client = UpdownClientFactory.Create("YOUR-API-KEY-HERE");
var delete = await client.CheckDelete("EXISTING-CHECK-TOKEN");
Pulse Monitoring (Cron/Background Job Monitoring)
Pulse monitoring is used to monitor cron jobs, background tasks, and scheduled processes. Unlike regular HTTP monitoring, pulse monitoring works by having your application send heartbeat signals TO Updown.io.
To use pulse monitoring:
- Create a pulse check in your Updown.io dashboard
- Updown.io will provide you with a unique pulse URL
- Your application/cron job should make HTTP requests TO that URL on schedule
- If Updown.io doesn't receive pulses within the expected timeframe, it will alert you
Example: Sending a pulse using the client library
var client = UpdownClientFactory.Create("YOUR-API-KEY-HERE");
// Send pulse using GET request (most common)
await client.SendPulse("https://pulse.updown.io/YOUR-TOKEN/YOUR-KEY");
// Send pulse using POST request (if needed)
await client.SendPulsePost("https://pulse.updown.io/YOUR-TOKEN/YOUR-KEY");
Example: Manual pulse (without using the client library)
// Simple pulse using HttpClient directly
using var httpClient = new HttpClient();
await httpClient.GetAsync("https://pulse.updown.io/YOUR-TOKEN/YOUR-KEY");
// Or using POST
await httpClient.PostAsync("https://pulse.updown.io/YOUR-TOKEN/YOUR-KEY", null);
Example: Pulse in a cron job or scheduled task
public async Task RunScheduledTask()
{
var client = UpdownClientFactory.Create("YOUR-API-KEY-HERE");
try
{
// Your actual work here
await DoImportantWork();
// Send success pulse when work completes successfully
await client.SendPulse("https://pulse.updown.io/YOUR-TOKEN/YOUR-KEY");
}
catch (Exception ex)
{
// Handle error - Updown.io will detect missing pulse
_logger.LogError(ex, "Scheduled task failed");
// Don't send pulse on failure, so Updown.io alerts you
}
}
Example: Pulse with error handling
public async Task SendHeartbeat(string pulseUrl)
{
var client = UpdownClientFactory.Create("YOUR-API-KEY-HERE");
try
{
await client.SendPulse(pulseUrl);
_logger.LogInformation("Pulse sent successfully");
}
catch (HttpRequestException ex)
{
_logger.LogError(ex, "Failed to send pulse");
// Handle pulse sending failure appropriately for your application
}
}
For more information about pulse monitoring, see: https://updown.io/doc/how-pulse-cron-monitoring-works
Contributing
Use your favorite IDE to open the project. The project was developed using Visual Studio.
git clone https://github.com/strvmarv/updown-dotnet.git
cd updown-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. 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. |
.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.6)
-
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.
pulse added