I'm having some weirdness occur when I run a Python script to grab ticket IDs from a subqueue we've set up in our OTRS instance. Despite specifying the subqueue I want and setting the UseSubQueues flag appropriately, my API call still pulls tickets from the main queue that fit the other parameters. For context, I want tickets in QueueID=27, which is a subqueue of QueueID=5 in our system. Any advice?
Code:
from requests import get as rgetfrom datetime import datefrom datetime import datetime as dtfrom datetime import timedelta, timezonetodaydt = dt.now()thirtyDaysdt = todaydt - timedelta(30)reqHeaders = {'Accept': 'application/json'}webservice = '[HOST]/otrs/nph-genericinterface.pl/Webservice/ConvCopierReports'# grab ticket IDs for the relevant tickets from the last 30 daysprint(thirtyDaysdt.strftime('%Y-%m-%d 00:00:01'))urlForAPI = webservice + '/TicketSearch?'params = { 'QueueID': 27, 'UseSubQueues': 1, 'TicketCreateTimeNewerDate': thirtyDaysdt.strftime('%Y-%m-%d 00:00:01'), 'UserLogin': OTRSLogin, 'Password': OTRSPassword}response = rget(url=urlForAPI, params=params, headers=reqHeaders)try: convCopierTicketIDs = response.json()['TicketID']except: print('No Convenience Copier tickets found')
Statistics: Posted by ATD39401 — 01 Aug 2024, 18:36 — Replies 0 — Views 35