Skip to content

Latest commit

 

History

History
394 lines (276 loc) · 9.93 KB

WebhooksApi.md

File metadata and controls

394 lines (276 loc) · 9.93 KB

Phrase::WebhooksApi

All URIs are relative to https://api.phrase.com/v2

Method HTTP request Description
webhook_create POST /projects/{project_id}/webhooks Create a webhook
webhook_delete DELETE /projects/{project_id}/webhooks/{id} Delete a webhook
webhook_show GET /projects/{project_id}/webhooks/{id} Get a single webhook
webhook_test POST /projects/{project_id}/webhooks/{id}/test Test a webhook
webhook_update PATCH /projects/{project_id}/webhooks/{id} Update a webhook
webhooks_list GET /projects/{project_id}/webhooks List webhooks

webhook_create

Webhook webhook_create(project_id, webhook_create_parameters, opts)

Create a webhook

Create a new webhook.

Example

# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
  # Configure HTTP basic authorization: Basic
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: Token
  config.api_key['Authorization'] = 'YOUR API KEY'
  config.api_key_prefix['Authorization'] = 'token'
end

api_instance = Phrase::WebhooksApi.new
project_id = 'project_id_example' # String | Project ID
webhook_create_parameters = Phrase::WebhookCreateParameters.new({callback_url: 'http://example.com/hooks/phraseapp-notifications'}) # WebhookCreateParameters | 
opts = {
  x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}

begin
  #Create a webhook
  result = api_instance.webhook_create(project_id, webhook_create_parameters, opts)
  pp result
rescue Phrase::ApiError => e
  puts "Exception when calling WebhooksApi->webhook_create: #{e}"
end

Parameters

Name Type Description Notes
project_id String Project ID
webhook_create_parameters WebhookCreateParameters
x_phrase_app_otp String Two-Factor-Authentication token (optional) [optional]

Return type

Response<(Webhook)>

Authorization

Basic, Token

HTTP request headers

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

webhook_delete

webhook_delete(project_id, id, opts)

Delete a webhook

Delete an existing webhook.

Example

# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
  # Configure HTTP basic authorization: Basic
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: Token
  config.api_key['Authorization'] = 'YOUR API KEY'
  config.api_key_prefix['Authorization'] = 'token'
end

api_instance = Phrase::WebhooksApi.new
project_id = 'project_id_example' # String | Project ID
id = 'id_example' # String | ID
opts = {
  x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}

begin
  #Delete a webhook
  api_instance.webhook_delete(project_id, id, opts)
rescue Phrase::ApiError => e
  puts "Exception when calling WebhooksApi->webhook_delete: #{e}"
end

Parameters

Name Type Description Notes
project_id String Project ID
id String ID
x_phrase_app_otp String Two-Factor-Authentication token (optional) [optional]

Return type

Response<(nil (empty response body))>

Authorization

Basic, Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

webhook_show

Webhook webhook_show(project_id, id, opts)

Get a single webhook

Get details on a single webhook.

Example

# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
  # Configure HTTP basic authorization: Basic
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: Token
  config.api_key['Authorization'] = 'YOUR API KEY'
  config.api_key_prefix['Authorization'] = 'token'
end

api_instance = Phrase::WebhooksApi.new
project_id = 'project_id_example' # String | Project ID
id = 'id_example' # String | ID
opts = {
  x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}

begin
  #Get a single webhook
  result = api_instance.webhook_show(project_id, id, opts)
  pp result
rescue Phrase::ApiError => e
  puts "Exception when calling WebhooksApi->webhook_show: #{e}"
end

Parameters

Name Type Description Notes
project_id String Project ID
id String ID
x_phrase_app_otp String Two-Factor-Authentication token (optional) [optional]

Return type

Response<(Webhook)>

Authorization

Basic, Token

HTTP request headers

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

webhook_test

webhook_test(project_id, id, opts)

Test a webhook

Perform a test request for a webhook.

Example

# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
  # Configure HTTP basic authorization: Basic
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: Token
  config.api_key['Authorization'] = 'YOUR API KEY'
  config.api_key_prefix['Authorization'] = 'token'
end

api_instance = Phrase::WebhooksApi.new
project_id = 'project_id_example' # String | Project ID
id = 'id_example' # String | ID
opts = {
  x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}

begin
  #Test a webhook
  api_instance.webhook_test(project_id, id, opts)
rescue Phrase::ApiError => e
  puts "Exception when calling WebhooksApi->webhook_test: #{e}"
end

Parameters

Name Type Description Notes
project_id String Project ID
id String ID
x_phrase_app_otp String Two-Factor-Authentication token (optional) [optional]

Return type

Response<(nil (empty response body))>

Authorization

Basic, Token

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

webhook_update

Webhook webhook_update(project_id, id, webhook_update_parameters, opts)

Update a webhook

Update an existing webhook.

Example

# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
  # Configure HTTP basic authorization: Basic
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: Token
  config.api_key['Authorization'] = 'YOUR API KEY'
  config.api_key_prefix['Authorization'] = 'token'
end

api_instance = Phrase::WebhooksApi.new
project_id = 'project_id_example' # String | Project ID
id = 'id_example' # String | ID
webhook_update_parameters = Phrase::WebhookUpdateParameters.new # WebhookUpdateParameters | 
opts = {
  x_phrase_app_otp: 'x_phrase_app_otp_example' # String | Two-Factor-Authentication token (optional)
}

begin
  #Update a webhook
  result = api_instance.webhook_update(project_id, id, webhook_update_parameters, opts)
  pp result
rescue Phrase::ApiError => e
  puts "Exception when calling WebhooksApi->webhook_update: #{e}"
end

Parameters

Name Type Description Notes
project_id String Project ID
id String ID
webhook_update_parameters WebhookUpdateParameters
x_phrase_app_otp String Two-Factor-Authentication token (optional) [optional]

Return type

Response<(Webhook)>

Authorization

Basic, Token

HTTP request headers

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

webhooks_list

Array<Webhook> webhooks_list(project_id, opts)

List webhooks

List all webhooks for the given project.

Example

# load the gem
require 'phrase'
# setup authorization
Phrase.configure do |config|
  # Configure HTTP basic authorization: Basic
  config.username = 'YOUR USERNAME'
  config.password = 'YOUR PASSWORD'

  # Configure API key authorization: Token
  config.api_key['Authorization'] = 'YOUR API KEY'
  config.api_key_prefix['Authorization'] = 'token'
end

api_instance = Phrase::WebhooksApi.new
project_id = 'project_id_example' # String | Project ID
opts = {
  x_phrase_app_otp: 'x_phrase_app_otp_example', # String | Two-Factor-Authentication token (optional)
  page: 1, # Integer | Page number
  per_page: 25 # Integer | Limit on the number of objects to be returned, between 1 and 100. 25 by default
}

begin
  #List webhooks
  result = api_instance.webhooks_list(project_id, opts)
  pp result
rescue Phrase::ApiError => e
  puts "Exception when calling WebhooksApi->webhooks_list: #{e}"
end

Parameters

Name Type Description Notes
project_id String Project ID
x_phrase_app_otp String Two-Factor-Authentication token (optional) [optional]
page Integer Page number [optional]
per_page Integer Limit on the number of objects to be returned, between 1 and 100. 25 by default [optional]

Return type

Response<(Array<Webhook>)>

Authorization

Basic, Token

HTTP request headers

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