API documentation and manual

API keys and registration

You need two things to push a message to your phone: An userkey and a collectionkey.

The userkey is a unique token that identifies your Pushington account. It must be send with every request and should stay secret. You can change it, but then you have to change it in all your applications and scripts.

The collectionkey references your collection. A collection is just a kind of category where you can group all your pushes. Like one collection for all pushes regarding server monitoring and another collection for checking the weather reports.

Send a push message

To push a message to your device just send a POST request to our default API endpoint located at


    https://pushington.org/api/push
        

The request should contain the following fields:

  • message: The message you would like yo send. Get creative here.
  • userkey: Your unique userkey. You can get your immutable user key from your dashboard.
  • collectionkey: Every collection has its own collection key. This will group together puish messages and therefor making it easier to manage different use-cases.

And that's it. No need for anything else. This message will be delivered to your device as fast as our servers and the Google GCM service can handle it. Most of the time, it's just a few (milli)seconds.

Examples

Curl:
curl -s \
     -F "message=hello from pushington" \
     -F "userkey=your-userkey" \
     -F "collectionkey=your-collectionkey" \
     https://pushington.org/api/push
Python, super easy together with requests:
import requests
payload = {
  'message': 'hello from pushington',
  'userkey': 'your-userkey'
  'collectionkey': 'your-collectionkey'
}
requests.post('https://pushington.org/api/push', data=payload)
Node.js (danke Jonas!):
var request = require('request');
request.post({
    uri: 'https://pushington.org/api/push/',
    form: {  'message': 'hello from pushington',
             'userkey': 'your-userkey',
             'collectionkey':  'your-collectionkey' }
});
Ruby:
require "net/https"
url = URI.parse("https://pushington.org/api/push")
req = Net::HTTP::Post.new(url.path)
req.set_form_data({
   :message => "hello pushington!",
   :userkey => "your-userkey",
   :collectionkey => "your-collectionkey",
})
res = Net::HTTP.new(url.host, url.port)
res.use_ssl = true
res.verify_mode = OpenSSL::SSL::VERIFY_PEER
res.start {|http| http.request(req) }

Android with android-aysnc-http:
AsyncHttpClient client = new AsyncHttpClient();
RequestParams params = new RequestParams();
params.add("userkey", "your-userkey");
params.add("collectionkey", "your-collectionkey");
params.add("message", "hello from pushington");
client.post(context, "https://pushington.org/api/push", params,
new AsyncHttpResponseHandler() {
    @Override
    public void onSuccess(String response) {
        // here you go
    }
});
Java:
URL url = new URL("https://pushington.org/api/push"); 
String data = "userkey=your-userkey&collectionkey=your-collectionkey&message=hello from pushington";
HttpURLConnection connection = (HttpURLConnection) url.openConnection();           
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setInstanceFollowRedirects(false);
connection.setRequestMethod("POST"); 
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); 
connection.setRequestProperty("charset", "utf-8");
connection.setRequestProperty("Content-Length", "" + Integer.toString(data.getBytes().length));
connection.setUseCaches(false);

DataOutputStream wr = new DataOutputStream(connection.getOutputStream());
wr.writeBytes(data);
wr.flush();
wr.close();
connection.disconnect();    
PHP:
<?php
$data = array(
  CURLOPT_POSTFIELDS => array(
    "userkey" => "your-userkey",
    "collectionkey" => "your-collectionkey",
    "message" => "hello from pushington"),
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_URL => "https://pushington.org/api/push",
));
$conn = curl_init();
curl_setopt_array($conn, $data);
$response = curl_exec($conn);
print_r($response);
curl_close($conn);
?>