GET request returning all ticket IDs in main queue rather than just a desired subqueue

Moderator: crythias

Locked
ATD39401
Znuny newbie
Posts: 21
Joined: 28 Jun 2024, 14:38
Znuny Version: 6.0.44
Real Name: Amber Denton
Company: UTK College of Veterinary Medicine

GET request returning all ticket IDs in main queue rather than just a desired subqueue

Post by ATD39401 »

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: Select all

from requests import get as rget
from datetime import date
from datetime import datetime as dt
from datetime import timedelta, timezone

todaydt = 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 days
print(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')
Locked