-
Notifications
You must be signed in to change notification settings - Fork 183
Configuration
Initial configuration is handled when creating a ZendeskAPI::Client
instance.
ZendeskAPI::Client.new do |config|
# code goes here
end
You must set the URL that will be used as the basis of API calls. It should always be in the format "https://mysubdomain.zendesk.com/api/v2".
config.url = "https://mysubdomain.zendesk.com/api/v2"
Currently, this client only supports Zendesk's v2 API. For forwards compatibility please make sure you have /api/v2 at the end of the URL, otherwise you may get cryptic error messages.
You must set up some form of authentication.
Setting the retry option to true will, after hitting the rate limit for an endpoint: notify the user, sleep automatically (based on the X-Retry-After header), and then retry the request.
config.retry = true
Logging can be controlled with the logger option. By default the logger will log WARN messages to STDERR.
# Both of these settings are the default:
config.logger = nil
config.logger = true
# For example, to log to STDOUT:
require 'logger'
config.logger = Logger.new(STDOUT)
You may change the faraday adapter through the adapter option or by setting Faraday.default_adapter
.
config.adapter = :patron
You may change the request/response cache by setting the cache option.
config.cache = ActiveSupport::Cache::MemoryStore.new
For more information see the Caching page.
The configuration can be accessed after Client initialization through ZendeskAPI::Client#config
.
config.username = "[email protected]"
config.password = "password"
config.username = "[email protected]"
# token found at Settings -> Channels -> API -> Token Access
config.token = "kX53RIXZKUFhZxSYhRxe7QGFocTkDmmERDxpcddF"
# these settings then create the following syntax:
# curl -u [email protected]/token:kX53RIXZKUFhZxSYhRxe7QGFocTkDmmERDxpcddF https://...
config.access_token = "kX53RIXZKUFhZxSYhRxe7QGFocTkDmmERDxpcddF"