Reference: Streaming Channel Push REST API

Gets subscriber information, and pushes notifications for streaming channels.

Syntax 

URI: /vXX.X/sobjects/StreamingChannel/Channel ID/push

Available since release: 29.0

Formats: JSON, XML

HTTP methods: GET, POST

Authentication: Authorization: Bearer token

Request body

For GET, no request body required. For POST, a request body that provides the push notification payload. This contains the following fields:

NameTypeDescription
pushEventsarray of push event payloadsList of event payloads to send notifications for.

Each push event payload contains the following fields:

NameTypeDescription
payloadstringInformation sent with notification. Cannot exceed 3,000 single-byte characters.
userIdsarray of User IDsList of subscribed users to send the notification to. If this array is empty, the notification will be broadcast to all subscribers on the channel.

Request parameters: None

Response data

For GET, information on the channel and subscribers is returned in the following fields:

NameTypeDescription
OnlineUserIdsarray of User IDsUser IDs of currently subscribed users to this channel.
ChannelNamestringName of the channel, for example, /u/notifications/ExampleUserChannel.

For POST, information on the channel and payload notification results is returned in an array of push results, each of which contains the following fields:

NameTypeDescription
fanoutCountnumberThe number of subscribers that the event got sent to. This is the count of subscribers specified in the POST request that were online. If the request was broadcast to all subscribers, fanoutCount will be –1. If no active subscribers were found for the channel, fanoutCount will be 0.
userOnlineStatusarray of User online status informationList of User IDs the notification was sent to and their listener status. If true the User ID is actively subscribed and listening, otherwise false.

Example 

The following is an example JSON response of a GET request for services/data/v29.0/sobjects/StreamingChannel/0M6D000000000g7KXA/push:

1{
2  "OnlineUserIds" : [ "005D0000001QXi1IAG" ],
3  "ChannelName" : "/u/notifications/ExampleUserChannel"
4}

Using a POST request to services/data/v29.0/sobjects/StreamingChannel/0M6D000000000g7KXA/push with a request JSON body of:

1{ 
2  "pushEvents": [
3      { 
4          "payload": "hello world!", 
5          "userIds": [ "005xx000001Svq3AAC", "005xx000001Svq4AAC" ] 
6      }, 
7      { 
8          "payload": "broadcast to everybody (empty user list)!", 
9          "userIds": [] 
10      } 
11   ] 
12}

the JSON response data looks something like:

1[ 
2  {
3    "fanoutCount" : 1,
4    "userOnlineStatus" : {
5        "005xx000001Svq3AAC" : true,
6        "005xx000001Svq4AAC" : false,
7    }
8  },
9  {
10    "fanoutCount" : -1,
11    "userOnlineStatus" : {
12    }
13  } 
14]