#!/usr/bin/perl use Kayako3::Staff; # this initializes Kayako3::Staff object, # performs the login, # parses the login response and stores the user session ID, # then initializes the info_response object which provides # all the info for id lookups later on my $help_desk = Kayako3::Staff->new({ username => 'bob', password => 'my_pass', api_url => 'http://example.com/staffapi?', }); # since the API requires integer ids, # I perform a lookup in separate steps for clarity # usually, I'll perform this all in one step: # $help_desk->get_ticket_list( # $help_desk->get_department_id("Support"), # $help_desk->get_ticket_status_id("New") # ); my $department_id = $help_desk->get_department_id("Support"); my $ticket_status_id = $help_desk->get_ticket_status_id("New"); $hd->get_ticket_list($department_id, $ticket_status_id) # once the ticket is loaded: print "Ticket count in " . $help_desk->ticket_list_response->department . ", for tickets with status " . $help_desk->ticket_list_response->status . ": " . $help_desk->get_ticket_count . "\n"; # sample output: # Ticket count in Support, for tickets with status New: 10 # then later on, I want to do the same thing # for a different department: my $department_id = $help_desk->get_department_id("Sales"); my $ticket_status_id = $help_desk->get_ticket_status_id("In progress"); $hd->get_ticket_list($department_id, $ticket_status_id) #Then I want to print the ticket count again, # for the new department, # but performing $help_desk->get_ticket_count # returns the same results above print "Ticket count in " . $help_desk->ticket_list_response->department . ", for tickets with status " . $help_desk->ticket_list_response->status . ": " . $help_desk->get_ticket_count . "\n"; # sample output: # Ticket count in Support, for tickets with status New: 10 # desired ouutput: # Ticket count in Sales, for tickets with status In Progress: 15