Jump to content

API - Support tickets for clientid


invoxivr

Recommended Posts

Hi - I am in process of wrapping up the phone ticket system and trying to optimize it further.

 

Now, the customers can call in and say their name or company name and system will go ahead and verify them with their pin code. Next, it will allow them to open a ticket.

 

For existing tickets, I am downloading all tickets and search for clientid.

 

But is there a way to access only the tickets based on client-id or at least by date. Downloading all tickets is taking lot of time for big customers.

 

I have looked everywhere in the API but no word on clientid.

 

Thanks.

Link to comment
Share on other sites

Hi - I am in process of wrapping up the phone ticket system and trying to optimize it further.

 

Now, the customers can call in and say their name or company name and system will go ahead and verify them with their pin code. Next, it will allow them to open a ticket.

 

For existing tickets, I am downloading all tickets and search for clientid.

 

But is there a way to access only the tickets based on client-id or at least by date. Downloading all tickets is taking lot of time for big customers.

 

I have looked everywhere in the API but no word on clientid.

 

Thanks.

 

I just wrote a simple API-script for this a few days ago.

 

/includes/api/getticketsbyuserid.php

<?php
/* 
Available fields:

- clientid
*/

$xml = null;

$result = mysql_query("SELECT * FROM tbltickets WHERE userid='".$_POST['clientid']."' ORDER BY lastreply DESC");
$amount = mysql_num_rows($result);

$xml .= "<whmcsapi>\n";
$xml .= "	<action>gettickets</action>\n";
$xml .= "	<result>success</result>\n";
$xml .= "	<totalresults>".$amount."</totalresults>\n";

if($amount !== 0)
{
$xml .= "	<tickets>\n";

while($row = mysql_fetch_array($result))
{
	$xml .= "		<ticket>\n";
	$xml .= "			<id>".$row['id']."</id>\n";
	$xml .= "			<tid>".$row['tid']."</tid>\n";
	$xml .= "			<deptid>".$row['did']."</deptid>\n";
	$xml .= "			<userid>".$row['userid']."</userid>\n";
	$xml .= "			<name>".$row['name']."</name>\n";
	$xml .= "			<email>".$row['email']."</email>\n";
	$xml .= "			<cc>".$row['cc']."</cc>\n";
	$xml .= "			<c>".$row['c']."</c>\n";
	$xml .= "			<date>".$row['date']."</date>\n";
	$xml .= "			<subject><![CDATA[".$row['title']."]]></subject>\n";
	$xml .= "			<message><![CDATA[".$row['message']."]]></message>\n";
	$xml .= "			<status>".$row['status']."</status>\n";
	$xml .= "			<priority>".$row['urgency']."</priority>\n";
	$xml .= "			<admin>".$row['admin']."</admin>\n";
	$xml .= "			<attachment>".$row['attachment']."</attachment>\n";
	$xml .= "			<lastreply>".$row['lastreply']."</lastreply>\n";
	$xml .= "			<flag>".$row['flag']."</flag>\n";
	$xml .= "			<service>".$row['service']."</service>\n";
	$xml .= "		</ticket>\n";
}

$xml .= "	</tickets>\n";
}

$xml .= "</whmcsapi>\n";

echo $xml;
?>

 

The action name is getticketsbyuserid.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated