Skip to content

Commit

Permalink
Updated example documentation for batch publish
Browse files Browse the repository at this point in the history
  • Loading branch information
sacOO7 committed Sep 15, 2023
1 parent 3c97ebf commit 5a196b2
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -419,16 +419,19 @@ DateTimeOffset time = await client.TimeAsync();
- It automatically adds necessary auth headers based on the initial auth config and supports pagination.
- The following is an example of using the batch publish API based on the [Ably batch publish rest endpoint documentation](https://ably.com/docs/api/rest-api#batch-publish).
```csharp
var jsonPayload =
@"{
""channels"" : [ ""channel1"", ""channel2"" ],
""messages"" : [
var objectPayload = new
{
channels = new[] { "channel1", "channel2", "channel3", "channel4" },
messages = new[]
{
new
{
""name"": ""eventName"",
""data"" : ""message"",
name = "eventName",
data = "foo",
}
]
}";
}
};
var jsonPayload = JsonConvert.SerializeObject(objectPayload);
var paginatedResponse = await ablyRest.Request(HttpMethod.Post, "/messages", null, jsonPayload, null);
```
- Follow official [ably rest endpoint doc](https://ably.com/docs/api/rest-api) for more information on other endpoints.
Expand Down

0 comments on commit 5a196b2

Please sign in to comment.