Sha256: b11bee65eed2a402a8b6fcd2bd1d82a983476e6fc15d42493d3d37c66ca1d925

Contents?: true

Size: 1.77 KB

Versions: 8

Compression:

Stored size: 1.77 KB

Contents

# Fastly::PublishApi


```ruby
require 'fastly'
api_instance = Fastly::PublishApi.new
```

## Methods

> [!NOTE]
> All URIs are relative to `https://api.fastly.com`

Method | HTTP request | Description
------ | ------------ | -----------
[**publish**](PublishApi.md#publish) | **POST** /service/{service_id}/publish/ | Send messages to Fanout subscribers


## `publish()`

```ruby
publish(opts): String # Send messages to Fanout subscribers
```

Send one or more messages to [Fanout](https://www.fastly.com/documentation/learning/concepts/real-time-messaging/fanout) subscribers. Each message specifies a channel, and Fanout will deliver the message to all subscribers of its channel. > **IMPORTANT:** For compatibility with GRIP, this endpoint requires a trailing slash, and the API token may be provided in the `Authorization` header (instead of the `Fastly-Key` header) using the `Bearer` scheme. 

### Examples

```ruby
api_instance = Fastly::PublishApi.new
opts = {
    service_id: 'service_id_example', # String | Alphanumeric string identifying the service.
    publish_request: Fastly::PublishRequest.new({items: [Fastly::PublishItem.new({channel: 'channel_example', formats: Fastly::PublishItemFormats.new})]}), # PublishRequest | 
}

begin
  # Send messages to Fanout subscribers
  result = api_instance.publish(opts)
  p result
rescue Fastly::ApiError => e
  puts "Error when calling PublishApi->publish: #{e}"
end
```

### Options

| Name | Type | Description | Notes |
| ---- | ---- | ----------- | ----- |
| **service_id** | **String** | Alphanumeric string identifying the service. |  |
| **publish_request** | [**PublishRequest**](PublishRequest.md) |  | [optional] |

### Return type

**String**

[[Back to top]](#) [[Back to API list]](../../README.md#endpoints)
[[Back to README]](../../README.md)

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fastly-9.0.0 docs/PublishApi.md
fastly-8.10.0 docs/PublishApi.md
fastly-8.9.0 docs/PublishApi.md
fastly-8.8.0 docs/PublishApi.md
fastly-8.7.0 docs/PublishApi.md
fastly-8.6.0 docs/PublishApi.md
fastly-8.5.0 docs/PublishApi.md
fastly-8.4.0 docs/PublishApi.md