Webservice API? WSDL Issue with SerachCriteria
Question asked by dhaddad - 7/8/2015 at 2:09 PM
I'm attempting to use the webservice, and having an issue:
It shows SearchCriteria as an array of string.
I've tried:
"IsOpen = True"
" 'IsOpen'='True'
etc.etc, i cant get it to work. 
searchCriteria String[] A list of 'key=value' pairs that indicate the search parameters. Possible key names are:
  • BrandId
  • DateEndUtc
  • DateStartUtc
  • DepartmentId
  • EmailAddress
  • GroupId
  • HasResolution
  • IsActive
  • IsDeleted
  • IsOpen
  • IsSpam
  • MaxResults
  • Priority
  • ShowInFollowUpView
  • SortOrder
  • TicketNumber
  • UserId
To search by custom fields, pass in the id of the field as the key and the search term as the value (ie: 1 = 'value')

9 Replies

Reply to Thread
User Replied
The first one seems like it should have worked. I can try to help better with some questions answered:
1. Are you calling GetTicketsBySearch?
2. Can I see a snippet of the code?
3. What is the result message and result code when it returns?
4. What exactly IS the issue? Is it returning back non-open tickets? is it returning no tickets? is it crashing? etc.
Thank you,
dhaddad Replied
        Dim userName As String = "User"
        Dim Password As String = "Pass"
        Dim args As New ST.ArrayOfString
        Dim CallWebService As New ST.svcTicketsSoapClient
        Dim sGetValue As ST.TicketInfoArrayResult = CallWebService.GetTicketsBySearch(userName, Password, args)
        Dim Tmp = sGetValue.Tickets.FirstOrDefault()
Im getting no tickets returned. Its not throwing an error. Ive tried BrandID, IsOpen, and IsActive with many different combinations of trying to pass the value in. 
Message = ""
MessageField ""
Result = True
Result Code 0
Result Code Field 0
Result Field = True
Tickets = 0
dhaddad Replied
Posted code sample below
User Replied
hmmm... The code looks correct, besides the single quotes around the '1' but it shouldnt stop it from returning. You could try just passing in a new blank string array and see if anything returns? Also, try going to the management interface and make sure the user you are using to login can see the tickets when searching through the web interface. This user needs to have the ability to see the tickets. (They need to be a part of the department the tickets are in)

i will also try to replicate this here locally and let you know what i find.

Also, Are you on Track 11x or 10x?
dhaddad Replied
I was able to get it working. Thanks for the help. Some comments / Questions, that may help others:
  • The user cannot be just an admin, it appears they have to be a member of both the employee  and manager group. Is this correct?
  • Is there a way to create a user that has API access that would not burn a license? It seems adding them to a manager role requires the agent role which requires license use.
  • We, as im sure many, use external authentication, so there is also the concern of it breaking when password changes.
Additionally, I'm not able to extract the subject of a ticket from anywhere. Ive reviewed the entire API. Ive tried: GetTicketConversationPartList, but it appears to not contain the initial subject from when the user submitted the ticket. 
The ticket item itself only contains the subject, but not the body. Was this intentional? 
dhaddad Replied
Posted some notes below, im on 11x FYI.
Employee Replied
Employee Post Marked As Answer
1. The admin does not have to be a manager but has to at least have the agent role to be able to see tickets. (you must be a agent to see tickets)
2. No i dont believe there is a way around this. The user must be at least an agent and can only search for tickets they can see (groups they are in) 
3. I seems there may be a concern if you are hardcoding the password. You may be able to write additional custom code to pass the password in from your provider. 

the subject of the ticket should be inside the TicketInfo object returned from GetTicketsBySearch OR when you call GetTicketConversationPartList the first item in the array, its description, is the subject.

To get details about a ticket message call GetTicketConversationPartList then use the partid as the messageid for GetTicketMessageHtml or GetTicketMessagePlainText
dhaddad Replied
I was able to get it working, however either you are incorrect, or the documentation is incorrect. 
GetTciektsBySearch returns:
The Subject is the actual subject of the ticket, not the body\message\description. I was able to retrieve the description by using the conversation part list. 
User Replied
Sorry yes, all of the messages (even the one that starts the ticket) will be a message (not part of the ticket). It was created this way as part of OOP (Object Oriented Programming) and also has to do with the way they are stored in the DB

Reply to Thread