HTTP REST Push API

This document descibes how to use PubNub JSON/JSONP REST API with HTTP GET. PubNub APIs are available in many programming languages. Visit the following link to download your language.

Download PubNub Push API on GitHub

We are building many Client APIs which hook ito PubNub Publish/Subscribe. If one is not available in your language, contact us and we will add it.

Grab your API Keys with the link below. Get API Keys You need the Publish and Subscribe Keys. Ignore the Secret Key for now, that's only for Browser Clients.

To publish a message, issue a GET Request in the following format.

PUBLISH

	http://pubsub.pubnub.com
	/publish
	/pub-key
	/sub-key
	/signature
	/channel
	/callback
	/message
	
Example:
	http://pubsub.pubnub.com
	/publish
	/demo
	/demo
	/0
	/hello_world
	/0
	/%22Hello%20World%22
	

PUBLISH TEST:
http://pubsub.pubnub.com/publish/demo/demo/0/hello_world/0/%22Hello%20World%22

SUBSCRIBE

	http://pubsub.pubnub.com
	/subscribe
	/sub-key
	/channel
	/callback
	/timetoken
	
Example:
	http://pubsub.pubnub.com
	/subscribe
	/demo
	/hello_world
	/0
	/0
	

SUBSCRIBE TEST:
http://pubsub.pubnub.com/subscribe/demo/hello_world/0/0

You will receive a response as an array. The first element of the array will be an empty array (at first) and the second is a timetoken. You must use this timetoken response from the server at every following request. Each response will have a brand new timetoken. So you must replace the old timetoken each time.

	    // Initial Response
	    [[],"9718304464409"]
	

Take the "timetoken" value and place it in the following request like this:

	http://pubsub.pubnub.com
	/subscribe
	/demo
	/hello_world
	/0
	/9718304464409
	

To load publish history, issue a GET request in the following format.

HISTORY

	http://pubsub.pubnub.com
	/history
	/sub-key
	/channel
	/callback
	/limit
	
Example:
	http://pubsub.pubnub.com
	/history
	/demo
	/hello_world
	/0
	/10
	

HISTORY TEST:
http://pubsub.pubnub.com/history/demo/hello_world/0/10

We recommend using our Client Push APIs. Find them on GitHub in your language.

Download PubNub Push API on GitHub