Skip to content

Latest commit

 

History

History
582 lines (411 loc) · 14.3 KB

InstanceApi.md

File metadata and controls

582 lines (411 loc) · 14.3 KB

OpenapiClient::InstanceApi

All URIs are relative to /api

Method HTTP request Description
change_webhook_url PUT /instances/{instance_key}/webhook Change Webhook url.
create_instance POST /instances/create Creates a new instance key.
delete_instance DELETE /instances/{instance_key}/delete Delete Instance.
get_contacts GET /instances/{instance_key}/contacts Get contacts.
get_instance GET /instances/{instance_key}/ Get Instance.
get_qr_code GET /instances/{instance_key}/qrcode Get QrCode.
list_instances GET /instances/list Get all instances.
logout_instance DELETE /instances/{instance_key}/logout Logout Instance.

change_webhook_url

change_webhook_url(instance_key, data)

Change Webhook url.

Changes the webhook url of an instance.

Examples

require 'time'
require 'openapi_client'
# setup authorization
OpenapiClient.configure do |config|
  # Configure API key authorization: ApiKeyAuth
  config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
end

api_instance = OpenapiClient::InstanceApi.new
instance_key = 'instance_key_example' # String | Instance key
data = OpenapiClient::WebhookPayload.new # WebhookPayload | Message data

begin
  # Change Webhook url.
  result = api_instance.change_webhook_url(instance_key, data)
  p result
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->change_webhook_url: #{e}"
end

Using the change_webhook_url_with_http_info variant

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

<Array(, Integer, Hash)> change_webhook_url_with_http_info(instance_key, data)

begin
  # Change Webhook url.
  data, status_code, headers = api_instance.change_webhook_url_with_http_info(instance_key, data)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <APIResponse>
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->change_webhook_url_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
instance_key String Instance key
data WebhookPayload Message data

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

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

create_instance

create_instance(data)

Creates a new instance key.

This endpoint is used to create a new WhatsApp Web instance.

Examples

require 'time'
require 'openapi_client'
# setup authorization
OpenapiClient.configure do |config|
  # Configure API key authorization: ApiKeyAuth
  config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
end

api_instance = OpenapiClient::InstanceApi.new
data = OpenapiClient::CreateInstancePayload.new # CreateInstancePayload | Instance data

begin
  # Creates a new instance key.
  result = api_instance.create_instance(data)
  p result
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->create_instance: #{e}"
end

Using the create_instance_with_http_info variant

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

<Array(, Integer, Hash)> create_instance_with_http_info(data)

begin
  # Creates a new instance key.
  data, status_code, headers = api_instance.create_instance_with_http_info(data)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <APIResponse>
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->create_instance_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
data CreateInstancePayload Instance data

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

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

delete_instance

delete_instance(instance_key)

Delete Instance.

Deletes the instance with the provided key.

Examples

require 'time'
require 'openapi_client'
# setup authorization
OpenapiClient.configure do |config|
  # Configure API key authorization: ApiKeyAuth
  config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
end

api_instance = OpenapiClient::InstanceApi.new
instance_key = 'instance_key_example' # String | Instance key

begin
  # Delete Instance.
  result = api_instance.delete_instance(instance_key)
  p result
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->delete_instance: #{e}"
end

Using the delete_instance_with_http_info variant

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

<Array(, Integer, Hash)> delete_instance_with_http_info(instance_key)

begin
  # Delete Instance.
  data, status_code, headers = api_instance.delete_instance_with_http_info(instance_key)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <APIResponse>
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->delete_instance_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
instance_key String Instance key

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

get_contacts

get_contacts(instance_key)

Get contacts.

Fetches the list of contacts in the instance.

Examples

require 'time'
require 'openapi_client'
# setup authorization
OpenapiClient.configure do |config|
  # Configure API key authorization: ApiKeyAuth
  config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
end

api_instance = OpenapiClient::InstanceApi.new
instance_key = 'instance_key_example' # String | Instance key

begin
  # Get contacts.
  result = api_instance.get_contacts(instance_key)
  p result
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->get_contacts: #{e}"
end

Using the get_contacts_with_http_info variant

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

<Array(, Integer, Hash)> get_contacts_with_http_info(instance_key)

begin
  # Get contacts.
  data, status_code, headers = api_instance.get_contacts_with_http_info(instance_key)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <APIResponse>
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->get_contacts_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
instance_key String Instance key

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

get_instance

get_instance(instance_key)

Get Instance.

Returns the instance data of single instance with connection status.

Examples

require 'time'
require 'openapi_client'
# setup authorization
OpenapiClient.configure do |config|
  # Configure API key authorization: ApiKeyAuth
  config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
end

api_instance = OpenapiClient::InstanceApi.new
instance_key = 'instance_key_example' # String | Instance key

begin
  # Get Instance.
  result = api_instance.get_instance(instance_key)
  p result
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->get_instance: #{e}"
end

Using the get_instance_with_http_info variant

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

<Array(, Integer, Hash)> get_instance_with_http_info(instance_key)

begin
  # Get Instance.
  data, status_code, headers = api_instance.get_instance_with_http_info(instance_key)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <APIResponse>
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->get_instance_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
instance_key String Instance key

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

get_qr_code

get_qr_code(instance_key)

Get QrCode.

Returns the qrcode in the base64 format.

Examples

require 'time'
require 'openapi_client'
# setup authorization
OpenapiClient.configure do |config|
  # Configure API key authorization: ApiKeyAuth
  config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
end

api_instance = OpenapiClient::InstanceApi.new
instance_key = 'instance_key_example' # String | Instance key

begin
  # Get QrCode.
  result = api_instance.get_qr_code(instance_key)
  p result
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->get_qr_code: #{e}"
end

Using the get_qr_code_with_http_info variant

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

<Array(, Integer, Hash)> get_qr_code_with_http_info(instance_key)

begin
  # Get QrCode.
  data, status_code, headers = api_instance.get_qr_code_with_http_info(instance_key)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <APIResponse>
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->get_qr_code_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
instance_key String Instance key

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

list_instances

list_instances

Get all instances.

Fetches the list of all Instances with login status.

Examples

require 'time'
require 'openapi_client'
# setup authorization
OpenapiClient.configure do |config|
  # Configure API key authorization: ApiKeyAuth
  config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
end

api_instance = OpenapiClient::InstanceApi.new

begin
  # Get all instances.
  result = api_instance.list_instances
  p result
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->list_instances: #{e}"
end

Using the list_instances_with_http_info variant

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

<Array(, Integer, Hash)> list_instances_with_http_info

begin
  # Get all instances.
  data, status_code, headers = api_instance.list_instances_with_http_info
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <APIResponse>
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->list_instances_with_http_info: #{e}"
end

Parameters

This endpoint does not need any parameter.

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

logout_instance

logout_instance(instance_key)

Logout Instance.

Logouts of the instance with the provided key.

Examples

require 'time'
require 'openapi_client'
# setup authorization
OpenapiClient.configure do |config|
  # Configure API key authorization: ApiKeyAuth
  config.api_key['ApiKeyAuth'] = 'YOUR API KEY'
  # Uncomment the following line to set a prefix for the API key, e.g. 'Bearer' (defaults to nil)
  # config.api_key_prefix['ApiKeyAuth'] = 'Bearer'
end

api_instance = OpenapiClient::InstanceApi.new
instance_key = 'instance_key_example' # String | Instance key

begin
  # Logout Instance.
  result = api_instance.logout_instance(instance_key)
  p result
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->logout_instance: #{e}"
end

Using the logout_instance_with_http_info variant

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

<Array(, Integer, Hash)> logout_instance_with_http_info(instance_key)

begin
  # Logout Instance.
  data, status_code, headers = api_instance.logout_instance_with_http_info(instance_key)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <APIResponse>
rescue OpenapiClient::ApiError => e
  puts "Error when calling InstanceApi->logout_instance_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
instance_key String Instance key

Return type

APIResponse

Authorization

ApiKeyAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: /