RapidAPI logo

Sign Up

Log In

PubNub

FREE
By dimashirokov
Updated 3 months ago
Communication
1.2/10
Popularity Score
386ms
Latency
100%
Success Rate

PubNub API Documentation

Apply real-time publish/subscribe messaging to your program.

View API Details
POSTgetUserState
POSThereNow
POSTpresence
POSTpublishMessage
POSTwhereNow
POSTgetUserState

The state API is used to get key/value pairs specific to a subscriber uuid.

Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
Required Parameters
channelsLIST
REQUIREDSpecifies the `channel` name to return occupancy results. If `channel` is not provided, `hereNow()` will return data for all `channels`. (`ch1`, `ch2`, `ch3`)
uuidSTRING
REQUIREDRequired: UUID to use, if not passed, a random will be generated.
subscribeKeyCREDENTIALS
REQUIREDRequired: The subscribe key obtained from PubNub.
Optional Parameters
channelGroupsLIST
OPTIONALThe channel group for which here now information should be received. (`ch1`, `ch2`, `ch3`)
cipherKeySTRING
OPTIONALIf passed, will encrypt the payloads.
authKeySTRING
OPTIONALIf PAM enabled, this key will be used on all requests.
Request Snippet
unirest.post("https://PubNubdimashirokovV1.p.rapidapi.com/getUserState")
.header("X-RapidAPI-Host", "PubNubdimashirokovV1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
Log inSign up

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://PubNubdimashirokovV1.p.rapidapi.com/getUserState")
.header("X-RapidAPI-Host", "PubNubdimashirokovV1.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication