Code samples code samples

    First thing you should do (after subscribing to is to get your API key. Just go in your channel configuration page, click on "Show API keys" button and copy the key. API key is in the format YY-YYYYYYYYYYYY.
    Once you have your channel API key, you are ready to send alerts.

    Here follow a few code samples for various languages.
    In each sample we used a dummy API key YY-YYYYYYYYYYYY and the same altert text "test alert".

    Unix/Windows command line - using curl (GET method)

    curl ''

    Unix/Windows command line - using curl (POST method)

    curl -X POST '' --data-urlencode 'apikey=YY-YYYYYYYYYYYY' --data-urlencode 'text=test alert'

    Unix command line - using wget

    wget -qO - ''

    Unix command line - using fetch (for BSD systems)

    fetch -o - ''

    PHP - using file_get_contents()

    $alert="test alert";
    echo "API reply: $rc\n";

    Javascript / NodeJS

    const https = require('https');
    https.get(''+encodeURIComponent("Houston, we have a problem!"));

    C# Microsoft or Mono

    using System;
    using System.Net.Http;
    using System.Web;
    public class EzalertmeSample {
      private static HttpClient client = new HttpClient();
      public static void Main(string[] args)   {
           String apik="YY-YYYYYYYYYYYY"; // channel API Key
          String text="This is my alert"; // Alert text content       String url="" + apik + "&text=" + HttpUtility.UrlEncode(text);        client.GetAsync(url);    // Send Alert (no answer expected)   } }

    Python - using requests module

    import requests
    params=(('apikey','YY-YYYYYYYYYYYY'), ('text','test alert'))
    rc=requests.get('', params)

    For more samples and details please checkout repo on GitHub

    Copyright © 2023 Powered by Codeguru