Hello everyone! I am developing an automation tool that collects ticket IDs from the Kernel::GenericInterface::Operation::Ticket::TicketSearch interface and performs operations on each ticket. I'm trying to access ticket information by looping through each ID and calling the Kernel::GenericInterface::Operation::Ticket::TicketGet interface, but the API call seemingly doesn't work like Ticket::TicketSearch's call.
Python script for grabbing relevant ticket IDsThe documentation suggests that the query should start in a similar format, i.e., [web_service_path]/TicketSearch?[params] and [web_service_path]/TicketGet?[params] respectively. However the following code doesn't respond with JSON-formatted ticket data, instead giving an error in the debugger that reads HTTP::REST Error while determine Operation for request URI '/TicketGet'. Should I not use TicketID as a parameter here? If so, how should I get ticket data like the Article, Subject, customer email, etc.?
Attached is my web service YAML file. Thank you in advance for any assistance that can be provided!
EDIT: changed urlForAPI in the second code snipped because I erroneously typed the entry point
Python script for grabbing relevant ticket IDs
Code:
# OTRSLogin and OTRSPassword defined elsewherereqHeaders = {'Accept': 'application/json'}webservice = 'https://[HOST]/otrs/nph-genericinterface.pl/Webservice/ConvCopierReports'urlForAPI = webservice + '/TicketSearch?'params = dict( QueueID=25, TicketCreateTimeNewerMinutes=42300, StateType='Open', UserLogin=OTRSLogin, Password=OTRSPassword)print(urlForAPI)# https://[HOST]/otrs/nph-genericinterface.pl/Webservice/ConvCopierReports/TicketSearch?response = requests.get(url=urlForAPI, params=params, headers=reqHeaders)printerTicketIDs = response.json()['TicketID']
Code:
for ticketID in printerTicketIDs: # pull the Article data for every ticket ID we returned from the "Printers" queue urlForAPI = webservice + '/TicketGet?' params = dict( TicketID=ticketID, UserLogin=OTRSLogin,Password=OTRSPassword ) response = requests.get(url=urlForAPI, params=params, headers=reqHeaders) print(response)# 500 response each time
EDIT: changed urlForAPI in the second code snipped because I erroneously typed the entry point
Statistics: Posted by ATD39401 — 26 Jul 2024, 19:36 — Replies 3 — Views 119