Description

Retrieve previously published messages for a given channel.

Code Example

PUBNUB.detailedHistory({    channel  : "hello_world",    subscribe_key  : "Hi!", start : 12345, end: 12389, reverse: false, count: 100,    callback : function(response) { log(response) }})

 

RESTful Example

_ NOTE _ : When using the REST service, it is critical that you make sure that all special characters are URL-encoded to ensure proper operation.  Native clients will automatically URL encode the data for you.

URL and Parameters

/v2/history/sub-key/ SUBSCRIBE_KEY /channel/ CHANNEL?start= START &end= END &reverse= REVERSE &count= COUNT


SUBSCRIBE_KEY is your assigned subscribe key. Subscribe keys begin with the prefix "sub-"

CHANNEL is the specific channel you wish to publish messages to.

START (optional) is the timetoken offset to start your request at.

END (optional) is the timetoken offset to end your request at.

REVERSE (optional) when searching, if true , return oldest to newest. If false (default), return newest to oldest.

COUNT (optional) number of results to return. Default is 100.

Request / Response Examples

Assuming say that the following messages were published to the channel:

m1, m2, m3, m4, m5, ... m100

Get all available history (up to 100 records) for my_channel on sub key demo

$ curl http://pubsub.pubnub.com/v2/history/sub-key/demo/channel/my_channel[[m100, m99, m98, m97, ... m1],13579287103468706,13579484916400996]

Get all available history (up to 100 records) for my_channel on sub key demo

$ curl http://pubsub.pubnub.com/v2/history/sub-key/demo/channel/my_channel[[{"text":"stuff"},"stuff",123],13579287103468706,13579484916400996]

Successful Response

[[{"text":"stuff"},"stuff",123],13579287103468706,13579484916400996]

Failure Response

[0,"Error description here"]