You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/api/rest-api.textile
+51
Original file line number
Diff line number
Diff line change
@@ -29,6 +29,7 @@ jump_to:
29
29
- list channel subscriptions#list-channel-subscriptions
30
30
- list channels#list-channels
31
31
- publish directly to device#push-publish
32
+
- publish via batch push API#push-publish-batch
32
33
Authentication API:
33
34
- requestToken#request-token
34
35
- revokeTokens#revoke-tokens
@@ -1152,6 +1153,56 @@ A successful request returns an empty response.
1152
1153
1153
1154
An unsuccessful request returns an error.
1154
1155
1156
+
h3(#push-publish-batch). Publish via batch push API
1157
+
1158
+
Convenience endpoint to deliver multiple push notification payloads to multiple devices or browsers in a single request by specifying a list of recipients and corresponding payloads.
1159
+
Currently the batch push endpoint allows a maximum of 10,000 recipients per request (recipients are counted per payload, so publishing two payloads to the same recipient counts as two recipients).
1160
+
1161
+
h6. POST rest.ably.io/push/batch/publish
1162
+
1163
+
The request body is an array of objects of the form:
1164
+
1165
+
bc[json]. {
1166
+
recipient: <recipient object or array of recipient objects>
1167
+
payload: <object>
1168
+
}
1169
+
1170
+
Where the recipient and payload fields are the same as those used in the "Publish a push notification to a single device":#push-publish endpoint.
1171
+
1172
+
Example request:
1173
+
1174
+
bc[sh]. curl -X POST https://rest.ably.io/push/admin/batch/publish \
Copy file name to clipboardExpand all lines: content/push/publish.textile
+60
Original file line number
Diff line number
Diff line change
@@ -778,6 +778,66 @@ var notification = new
778
778
rest.Push.Admin.Publish(recipient, notification);
779
779
```
780
780
781
+
h3(#via-batch-push-api). Publish via batch push API
782
+
783
+
The batch push API allows you to publish push notifications to multiple devices or browsers in a single request. This is useful when you need to send a large number of distinct push notifications to multiple recipients. If you are publishing the same notification to multiple recipients, prefer publishing "via channels":#via-channels.
784
+
The batch push endpoint accepts a JSON array of @PushPublishSpec@ objects, each of which contains a @recipient@ or array of recipients, and a @payload@, where @payload@ is the same as the payload you would use in a normal direct publish request.
785
+
Currently the batch push endpoint allows a maximum of 10,000 recipients per request (recipients are counted per payload, so publishing two payloads to the same recipient counts as two recipients).
786
+
787
+
The following example shows how to publish multiple push notifications in one request using the batch API with the generic REST SDK @request@ method:
Publishing via channels is modeled on Ably's "channel":#channels infrastructure, facilitating the delivery of push notifications across a network of subscribed devices or browsers. This process publishes messages through predefined channels, which devices or browsers must "subscribe":#sub-channels to in order to receive updates. This process ensures registered devices or browsers in the specified channels receive the correct push notifications. Publishing via channels is particularly useful for publishing notifications to multiple groups with varying privileges.
0 commit comments