Skip to content

Instantly share code, notes, and snippets.

@rtekie
Created August 26, 2012 03:30
Show Gist options
  • Select an option

  • Save rtekie/3473586 to your computer and use it in GitHub Desktop.

Select an option

Save rtekie/3473586 to your computer and use it in GitHub Desktop.
C# example of using API to notify CronSentry upon a job completion
// C# example of using API to notify CronSentry upon a job completion
// For API documentation please go to http://www.cronsentry.com/help#api
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RestSharp;
class CronsentryNotifyApp
{
static void Main(string[] args)
{
// set POST variables
var client = new RestClient("http://api.cronsentry.com/api/v1");
var request = new RestRequest("notifications", Method.POST);
request.AddParameter("api_key", "YOUR_API_KEY");
request.AddParameter("job_name", "Your job name");
request.AddParameter("status", "1");
request.AddParameter("message", "Please change me");
// do POST
IRestResponse response = client.Execute(request);
// check response
var content = response.Content;
System.Console.WriteLine(content);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment