All URIs are relative to https://www.polaraccesslink.com
Method | HTTP request | Description |
---|---|---|
create_webhook | POST /v3/webhooks | Create webhook |
delete_webhook | DELETE /v3/webhooks/{webhook-id} | Delete webhook |
get_webhook | GET /v3/webhooks | Get webhook |
update_webhook | PATCH /v3/webhooks/{webhook-id} | Update webhook |
CreatedWebhook create_webhook(webhook_request)
Create webhook
Create new webhook. When creating webhook the Accesslink sends a ping message to the url in request body. The ping message must be answered with 200 OK or otherwise the webhook is not created. Note! Save the signature_secret_key from response since this is the only chance to get it.
# load the gem
require 'polar-api-v3'
# setup authorization
Polar.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
end
api_instance = Polar::WebhooksApi.new
webhook_request = Polar::WebhookRequest.new # WebhookRequest | Webhook to create.
begin
#Create webhook
result = api_instance.create_webhook(webhook_request)
p result
rescue Polar::ApiError => e
puts "Exception when calling WebhooksApi->create_webhook: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
webhook_request | WebhookRequest | Webhook to create. |
- Content-Type: application/json
- Accept: application/json
delete_webhook(webhook_id)
Delete webhook
Delete webhook by id.
# load the gem
require 'polar-api-v3'
# setup authorization
Polar.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
end
api_instance = Polar::WebhooksApi.new
webhook_id = 56 # Integer | Webhook id to delete
begin
#Delete webhook
api_instance.delete_webhook(webhook_id)
rescue Polar::ApiError => e
puts "Exception when calling WebhooksApi->delete_webhook: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
webhook_id | Integer | Webhook id to delete |
nil (empty response body)
- Content-Type: Not defined
- Accept: application/json
WebhookInfo get_webhook
Get webhook
Returns created webhook if exists.
# load the gem
require 'polar-api-v3'
# setup authorization
Polar.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
end
api_instance = Polar::WebhooksApi.new
begin
#Get webhook
result = api_instance.get_webhook
p result
rescue Polar::ApiError => e
puts "Exception when calling WebhooksApi->get_webhook: #{e}"
end
This endpoint does not need any parameter.
- Content-Type: Not defined
- Accept: application/json
WebhookInfo update_webhook(webhook_id, webhook_patch)
Update webhook
Edit webhook event types and/or url. When updating webhook url the Accesslink sends a ping message to the new address. The ping message must be answered with 200 OK or otherwise the webhook is not updated.
# load the gem
require 'polar-api-v3'
# setup authorization
Polar.configure do |config|
# Configure HTTP basic authorization: Basic
config.username = 'YOUR USERNAME'
config.password = 'YOUR PASSWORD'
end
api_instance = Polar::WebhooksApi.new
webhook_id = 56 # Integer | Webhook id to update
webhook_patch = Polar::WebhookPatch.new # WebhookPatch | New value(s) for events and/or url.
begin
#Update webhook
result = api_instance.update_webhook(webhook_id, webhook_patch)
p result
rescue Polar::ApiError => e
puts "Exception when calling WebhooksApi->update_webhook: #{e}"
end
Name | Type | Description | Notes |
---|---|---|---|
webhook_id | Integer | Webhook id to update | |
webhook_patch | WebhookPatch | New value(s) for events and/or url. |
- Content-Type: application/json
- Accept: application/json