We no longer accept new accounts.
However, you can host the service yourself.
We continue to service existing customers.

How to use - NiceApi.Net.

This page describs what you have to de to use our service.


1) You register with your email address and up to three mobile number to which you have access to. We allocate you an unique UserId.

2) You change you application to send a http or hppts post request to our host. This post request contains your UserId, the phone number where you want to send your message to and the message text.

3) We deliver your message for you.


Here are some examples in various languages showing how to send the HTTP POST request:
- in Pythen
- in C#
- in Visual Basic
- in Java
- with curl
- if you have a working example in another language, please let us know.
For a list of possible host responses, please see our github wiki.

In Pythen 3
# Python 3
import http.client

yourId = "<Your unique X-APIId>"
yourMobile = "<Mobile number>"
yourMessage = "What a great day."

c = http.client.HTTPSConnection("NiceApi.net")
c.request("POST", "/API", yourMessage, {"X-APIId": yourId, "X-APIMobile": yourMobile})
response = c.getresponse()
data = response.read()
print (data)

In C#:
using System;
using System.Net;
using System.Net.Http;
using System.IO;

namespace CS_Example
{
    class Program
    {
        static void Main(string[] args)
        {
            string yourId = "<Your unique X-APIId>";
            string yourMobile = "<Mobile number>";
            string yourMessage = "What a great day.";

            try
            {
                string url = "https://NiceApi.net/API";
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.Method = "POST"
                request.ContentType = "application/x-www-form-urlencoded"
                request.Headers.Add("X-APIId", yourId)
                request.Headers.Add("X-APIMobile", yourMobile)
                using (StreamWriter streamOut = new StreamWriter(request.GetRequestStream()))
                {
                    streamOut.Write(yourMessage);
                }
                using (StreamReader streamIn = new StreamReader(request.GetResponse().GetResponseStream()))
                {
                    Console.WriteLine(streamIn.ReadToEnd());
                }
            }
            catch (SystemException se)
            {
                Console.WriteLine(se.Message);
            }
            Console.ReadLine();
        }
    }
}

In Visual Basic:
Imports System
Imports System.Net
Imports System.Net.Http
Imports System.IO

Module Module1
    Sub Main()
        Dim yourId As String = "<Your unique X-APIId>"
        Dim yourMobile As String = "<Mobile number>"
        Dim yourMessage As String = "What a great day."

        Try
            Dim url As String = "https://NiceApi.net/API"
            Dim request As System.Net.HttpWebRequest = CType(System.Net.WebRequest.Create(url), System.Net.HttpWebRequest)
            request.Method = "POST";
            request.ContentType = "application/x-www-form-urlencoded";
            request.Headers.Add("X-APIId", yourId);
            request.Headers.Add("X-APIMobile", yourMobile);
            Using streamOut As New StreamWriter(request.GetRequestStream())
                streamOut.Write(yourMessage)
            End Using
            Using streamIn As New StreamReader(request.GetResponse().GetResponseStream())
                Console.WriteLine(streamIn.ReadToEnd())
            End Using
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try
    End Sub
End Module

In Java:
// tested with OpenJDK version 1.8       
import java.net.*;
import java.io.*;

public class NiceApiDemo {
    public static void main(String[] args) { 
        String yourId = "<Your unique X-APIId>";
        String yourMobile = "<Mobile number>";
        String yourMessage = "What a great day.";
        
        HttpURLConnection connection = null;
        try {
            URL url = new URL("https://NiceApi.net/API");
            connection = (HttpURLConnection) url.openConnection();
            connection.setRequestMethod("POST");
            connection.setRequestProperty("X-APIId", yourId);
            connection.setRequestProperty("X-APIMobile", yourMobile);
            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
            connection.setUseCaches(false);
            connection.setDoOutput(true);
            DataOutputStream streamOut = new DataOutputStream(connection.getOutputStream());
            streamOut.writeBytes(yourMessage);
            streamOut.close();
            InputStream streamIn = connection.getInputStream();
            BufferedReader readerIn = new BufferedReader(new InputStreamReader(streamIn));
            System.out.println(readerIn.readLine());
            readerIn.close();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
        }
    }    
}

With curl:
curl -d "What a great day." --header "X-APIId: <Your unique X-APIId>" --header "X-APIMobile: <Mobile number>" https://NiceApi.net/API