Skip to content

Configuration

Steven Davidovitz edited this page May 13, 2013 · 7 revisions

Initial configuration is handled when creating a ZendeskAPI::Client instance.

  ZendeskAPI::Client.new do |config|
    # code goes here
  end

Mandatory Options

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.

Options

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.

Change a Configuration Setting

The configuration can be accessed after Client initialization through ZendeskAPI::Client#config.

Clone this wiki locally