CFTicket has a web service that will get a list of tickets created by a user. The email of the user must be specified and only tickets that match that email will be returned. You can then use the ticket numbers returned to get the actual ticket details.
<cfscript> if ( isDefined("form.email") ) { // Change www.mydomain.com to your own server ws = CreateObject("webservice", "http://www.mydomain.com/cfticket2/controllers/TicketController.cfc?wsdl"); //Params: Email userTickets = ws.GetTicketsByEmail(form.email); } </cfscript> <cfif IsDefined("userTickets")> <cfdump var="#XMLParse(userTickets)#"> </cfif> <html> <head> <title>Client Area</title> </head> <body> <form action="test.cfm" method="post"> Email <input type="text" name="email"><br> <input type="submit" name="submit"> </form> </body> </html>
The only parameter passed to the webservice is the email of the user whos tickets are to be returned. Only tickets with matching email addresses will be returned. No partial matches are returned.
The returned string is an XML document. You may use the <CFDUMP> tag to view the contents of the XML string. You may use ColdFusions XML functions to read and manipulate this data.
CFTicket has a web service that exposes ticket information. Below is an example of how you could incorporate this web service into your website that would then allow a customer to login and see the status of their ticket(s). Below is a small sample program that you can customize to fit your needs.
<cfscript> if ( isDefined("form.email") ) { // Change www.mydomain.com to your own server ws = CreateObject("webservice", "http://www.mydomain.com/cfticket2/controllers/TicketController.cfc?wsdl"); //Params: Email, Ticket # userTicket = ws.GetTicket(form.email, form.ticket); } </cfscript> <cfif IsDefined("userTicket")> <cfdump var="#XMLParse(userTicket)#"> </cfif> <html> <head> <title>Client Area</title> </head> <body> <form action="test.cfm" method="post"> Email <input type="text" name="email"><br> Ticket # <input type="text" name="ticket"><br> <input type="submit" name="submit"> </form> </body> </html>
The first parameter to the webservice is the customers email address. The second parameter is the ticket number the customer wishes to see. The webservice will only return ticket information if the customer email is the same as the email address in CFTicket for the given ticket number. If an invalid email address or an invalid ticket number is passed, an empty string is returned. You must check for this before parsing the XML document.
The returned string is an XML document. You may use the <CFDUMP> tag to view the contents of the XML string. You may use ColdFusions XML functions to read and manipulate this data.