site logo

Example: Ticket list (php)


Example: Ticket listing (php)  

#!/usr/bin/php
<?php 
# This script demonstrates the Mojo Helpdesk Ticket API ( SOAP access)
# Demonstrates search and ticket listing capability
 
# You will need to adjust the URL and MYID values:
#
# URL - Base URL to your helpdesk.
#
# MYID - Your access key, as displayed on your "profile" page
#
#
# Configuration settings.
#
$URL = "http://mycompany.mojohelpdesk.com" ;
$MYID = "ec91417dddfd7jhgkjhgkjhgjkhg53dce59058932" ;
#
# Create the SOAP client
#
$client = new SoapClient($URL); 
#
# Construct the search query.
# ( search for open tickets older than 3 days )
#
$mysrch = array(
                "status"=>"open",
                "created_days_before_or_after" => "before",
                "assigned_to_id" => "",
                "created_by_id" => "",
                "results_per_page" => 10,
                "queue" => "",
                "updated_days" => "",
                "sort_column" => "",
                "updated_days_before_or_after" => "",
                "sort_is_reversed" => "",
                "page" => 2,
                "created_days" => "3",
                "queue_id" => "",
                "priority_id" => "",
                "priority" => "",
                "status_id" => "",
                "query_string" => "",
                "company_id" => "") ;
#
# Execute the query.
#
$result = $client->FindTickets($MYID,$mysrch);
 
#
# Process the results.
#
foreach ($result->tickets as $t => $value) {
print_r("Ticket:\t" . $value->id . "\r\n") ;
print_r("Title:\t" . $value->title . "\r\n") ;
print_r("Status:\t" . $value->status . "\r\n") ;
print_r("Created by: " . $value->created_by->full_name . "\r\n") ;
print_r("Company name: " . $value->company->name . "\r\n") ;
print_r("Company id: " .  $value->company->id . "\r\n") ;
print_r("URL:\t" . $value->url . "\r\n") ;
print_r("\n") ;
?>

#!/usr/bin/php

<?php 

# This script demonstrates the Mojo Helpdesk Ticket API ( SOAP access)

# Demonstrates search and ticket listing capability

 

# You will need to adjust the URL and MYID values:

#

# URL - Base URL to your helpdesk.

#

# MYID - Your access key, as displayed on your "profile" page

#


#

# Configuration settings.

#

$URL = "http://mycompany.mojohelpdesk.com" ;

$MYID = "ec91417dddfd7jhgkjhgkjhgjkhg53dce59058932" ;



#

# Create the SOAP client

#

$client = new SoapClient($URL); 


#

# Construct the search query.

# ( search for open tickets older than 3 days )

#

$mysrch = array(

                "status"=>"open",

                "created_days_before_or_after" => "before",

                "assigned_to_id" => "",

                "created_by_id" => "",

                "results_per_page" => 10,

                "queue" => "",

                "updated_days" => "",

                "sort_column" => "",

                "updated_days_before_or_after" => "",

                "sort_is_reversed" => "",

                "page" => 2,

                "created_days" => "3",

                "queue_id" => "",

                "priority_id" => "",

                "priority" => "",

                "status_id" => "",

                "query_string" => "",

                "company_id" => "") ;


#

# Execute the query.

#

$result = $client->FindTickets($MYID,$mysrch);

 

#

# Process the results.

#

foreach ($result->tickets as $t => $value) {

print_r("Ticket:\t" . $value->id . "\r\n") ;

print_r("Title:\t" . $value->title . "\r\n") ;

print_r("Status:\t" . $value->status . "\r\n") ;

print_r("Created by: " . $value->created_by->full_name . "\r\n") ;

print_r("Company name: " . $value->company->name . "\r\n") ;

print_r("Company id: " .  $value->company->id . "\r\n") ;

print_r("URL:\t" . $value->url . "\r\n") ;

print_r("\n") ;


?>