Skip to content

Latest commit

 

History

History
354 lines (246 loc) · 9.85 KB

File metadata and controls

354 lines (246 loc) · 9.85 KB

Late::WebhooksApi

All URIs are relative to https://zernio.com/api

Method HTTP request Description
create_webhook_settings POST /v1/webhooks/settings Create webhook
delete_webhook_settings DELETE /v1/webhooks/settings Delete webhook
get_webhook_settings GET /v1/webhooks/settings List webhooks
test_webhook POST /v1/webhooks/test Send test webhook
update_webhook_settings PUT /v1/webhooks/settings Update webhook

create_webhook_settings

create_webhook_settings(create_webhook_settings_request)

Create webhook

Create a new webhook configuration. Maximum 10 webhooks per user. name, url and events are required. url must be a valid URL and events must contain at least one event. Whitespace is trimmed from url before validation. Webhooks are automatically disabled after 10 consecutive delivery failures.

Examples

require 'time'
require 'late-sdk'
# setup authorization
Late.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Late::WebhooksApi.new
create_webhook_settings_request = Late::CreateWebhookSettingsRequest.new({name: 'name_example', url: 'url_example', events: ['post.scheduled']}) # CreateWebhookSettingsRequest | 

begin
  # Create webhook
  result = api_instance.create_webhook_settings(create_webhook_settings_request)
  p result
rescue Late::ApiError => e
  puts "Error when calling WebhooksApi->create_webhook_settings: #{e}"
end

Using the create_webhook_settings_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> create_webhook_settings_with_http_info(create_webhook_settings_request)

begin
  # Create webhook
  data, status_code, headers = api_instance.create_webhook_settings_with_http_info(create_webhook_settings_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <UpdateWebhookSettings200Response>
rescue Late::ApiError => e
  puts "Error when calling WebhooksApi->create_webhook_settings_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
create_webhook_settings_request CreateWebhookSettingsRequest

Return type

UpdateWebhookSettings200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

delete_webhook_settings

delete_webhook_settings(id)

Delete webhook

Permanently delete a webhook configuration.

Examples

require 'time'
require 'late-sdk'
# setup authorization
Late.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Late::WebhooksApi.new
id = 'id_example' # String | Webhook ID to delete

begin
  # Delete webhook
  result = api_instance.delete_webhook_settings(id)
  p result
rescue Late::ApiError => e
  puts "Error when calling WebhooksApi->delete_webhook_settings: #{e}"
end

Using the delete_webhook_settings_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> delete_webhook_settings_with_http_info(id)

begin
  # Delete webhook
  data, status_code, headers = api_instance.delete_webhook_settings_with_http_info(id)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <UpdateYoutubeDefaultPlaylist200Response>
rescue Late::ApiError => e
  puts "Error when calling WebhooksApi->delete_webhook_settings_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
id String Webhook ID to delete

Return type

UpdateYoutubeDefaultPlaylist200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

get_webhook_settings

get_webhook_settings

List webhooks

Retrieve all configured webhooks for the authenticated user. Supports up to 10 webhooks per user.

Examples

require 'time'
require 'late-sdk'
# setup authorization
Late.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Late::WebhooksApi.new

begin
  # List webhooks
  result = api_instance.get_webhook_settings
  p result
rescue Late::ApiError => e
  puts "Error when calling WebhooksApi->get_webhook_settings: #{e}"
end

Using the get_webhook_settings_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_webhook_settings_with_http_info

begin
  # List webhooks
  data, status_code, headers = api_instance.get_webhook_settings_with_http_info
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetWebhookSettings200Response>
rescue Late::ApiError => e
  puts "Error when calling WebhooksApi->get_webhook_settings_with_http_info: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return type

GetWebhookSettings200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

test_webhook

test_webhook(test_webhook_request)

Send test webhook

Send a test webhook to verify your endpoint is configured correctly. The test payload includes event: "webhook.test" to distinguish it from real events.

Examples

require 'time'
require 'late-sdk'
# setup authorization
Late.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Late::WebhooksApi.new
test_webhook_request = Late::TestWebhookRequest.new({webhook_id: 'webhook_id_example'}) # TestWebhookRequest | 

begin
  # Send test webhook
  result = api_instance.test_webhook(test_webhook_request)
  p result
rescue Late::ApiError => e
  puts "Error when calling WebhooksApi->test_webhook: #{e}"
end

Using the test_webhook_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> test_webhook_with_http_info(test_webhook_request)

begin
  # Send test webhook
  data, status_code, headers = api_instance.test_webhook_with_http_info(test_webhook_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <UnpublishPost200Response>
rescue Late::ApiError => e
  puts "Error when calling WebhooksApi->test_webhook_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
test_webhook_request TestWebhookRequest

Return type

UnpublishPost200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

update_webhook_settings

update_webhook_settings(update_webhook_settings_request)

Update webhook

Update an existing webhook configuration. All fields except _id are optional; only provided fields will be updated. When provided, name must be 1-50 characters, url must be a valid URL, and events must contain at least one event. Whitespace is trimmed from url before validation. Webhooks are automatically disabled after 10 consecutive delivery failures.

Examples

require 'time'
require 'late-sdk'
# setup authorization
Late.configure do |config|
  # Configure Bearer authorization (JWT): bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Late::WebhooksApi.new
update_webhook_settings_request = Late::UpdateWebhookSettingsRequest.new({_id: '_id_example'}) # UpdateWebhookSettingsRequest | 

begin
  # Update webhook
  result = api_instance.update_webhook_settings(update_webhook_settings_request)
  p result
rescue Late::ApiError => e
  puts "Error when calling WebhooksApi->update_webhook_settings: #{e}"
end

Using the update_webhook_settings_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> update_webhook_settings_with_http_info(update_webhook_settings_request)

begin
  # Update webhook
  data, status_code, headers = api_instance.update_webhook_settings_with_http_info(update_webhook_settings_request)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <UpdateWebhookSettings200Response>
rescue Late::ApiError => e
  puts "Error when calling WebhooksApi->update_webhook_settings_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
update_webhook_settings_request UpdateWebhookSettingsRequest

Return type

UpdateWebhookSettings200Response

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json