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

NAME

API::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::WithX - optionally pass a Cache::FileCache object to cache and avoid unnecessary requests

zendesk_token

Required.

zendesk_username

Required.

backoff_time

Optional. Default: 10

Time in seconds to back off before retrying request if a http 429 (Too Many Requests) response is received.

zendesk_api_url

Optional. Default: https://elasticsearch.zendesk.com/api/v2

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

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_organizationt

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 get

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

COPYRIGHT

Copyright 2015, Robin Clarke

AUTHOR

Robin Clarke <robin@robinclarke.net>

Jeremy Falling