The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::Zendesk

DESCRIPTION

Manage Zendesk connection, get tickets etc. This is a work-in-progress - we have only written the access methods we have used so far, but as you can see, it is a good template to extend for all remaining API endpoints. I'm totally open for any pull requests! :)

This module uses MooseX::Log::Log4perl for logging - be sure to initialize!

ATTRIBUTES

cache

Optional.

Provided by MooseX::WithCache - optionally pass a cache object to cache and avoid unnecessary requests

zendesk_token

Required.

zendesk_username

Required.

default_backoff Optional. Default: 10 Time in seconds to back off before retrying request. If a 429 response is given and the Retry-Time header is provided by the api this will be overridden.
retry_on_status Optional. Default: [ 429, 500, 502, 503, 504 ] Which http response codes should we retry on?
max_tries Optional. Default: undef Limit maximum number of times a query should be attempted before failing. If undefined then unlimited retries
zendesk_api_url

Required.

user_agent

Optional. A new LWP::UserAgent will be created for you if you don't already have one you'd like to reuse.

METHODS

init

Create the user agent and credentials. As these are built lazily, initialising manually can avoid errors thrown when building them later being silently swallowed in try/catch blocks.

get_incremental_tickets

Access the Incremental Ticket Export interface

!! Broken !!

Access the Search interface

Parameters

query

Required. Query string

sort_by

Optional. Default: "updated_at"

sort_order

Optional. Default: "desc"

size

Optional. Integer indicating the number of entries to return. The number returned may be slightly larger (paginating will stop when this number is exceeded).

Returns array of results.

get_comments_from_ticket

Access the List Comments interface

Parameters

ticket_id

Required. The ticket id to query on.

Returns an array of comments

download_attachment

Download an attachment.

Parameters

attachment

Required. An attachment HashRef as returned as part of a comment.

dir

Directory to download to

force

Force overwrite if item already exists

Returns path to the downloaded file

get_attachment

Get attachment objects

Parameters

id

required. The id of the attachment

Returns attachment object

add_response_to_ticket

Shortcut to Updating Tickets specifically for adding a response.

ticket_id

Required. Ticket to add response to

public

Optional. Default: 0 (not public). Set to "1" for public response

response

Required. The text to be addded to the ticket as response.

Returns response HashRef

update_ticket

Access Updating Tickets interface.

ticket_id

Required. Ticket to add response to

body

Required. HashRef of valid parameters - see link above for details.

Returns response HashRef

get_ticket

Access Getting Tickets interface.

ticket_id

Required. Ticket to get

no_cache

Disable cache get/set for this operation

Returns ticket HashRef

get_many_tickets

Access Show Many Organizations interface.

ticket_ids

Required. ArrayRef of ticket ids to get

no_cache

Disable cache get/set for this operation

Returns an array of ticket HashRefs

get_organization

Get a single organization by accessing Getting Organizations interface with a single organization_id. The get_many_organizations interface detailed below is more efficient for getting many organizations at once.

organization_id

Required. Organization id to get

no_cache

Disable cache get/set for this operation

Returns organization HashRef

get_many_organizations
organization_ids

Required. ArrayRef of organization ids to get

no_cache

Disable cache get/set for this operation

Returns an array of organization HashRefs

update_organization

Use the Update Organization interface.

organization_id

Required. Organization id to update

details

Required. HashRef of the details to be updated.

no_cache

Disable cache set for this operation

returns the

list_organization_users

Use the List Users interface.

organization_id

Required. Organization id to get users from

no_cache

Disable cache set/get for this operation

Returns array of users

get_many_users

Access Show Many Users interface.

user_ids

Required. ArrayRef of user ids to get

no_cache

Disable cache get/set for this operation

Returns an array of user HashRefs

update_user

Use the Update User interface.

user_id

Required. User id to update

details

Required. HashRef of the details to be updated.

no_cache

Disable cache set for this operation

returns the

list_user_assigned_tickets

Use the List assigned tickets interface.

user_id

Required. User id to get assigned tickets from

no_cache

Disable cache set/get for this operation

Returns array of tickets

clear_cache_object_id

Clears an object from the cache.

user_id

Required. Object id to clear from the cache.

Returns whether cache_del was successful or not

COPYRIGHT

Copyright 2015, Robin Clarke

AUTHOR

Robin Clarke <robin@robinclarke.net>

Jeremy Falling <projects@falling.se>