API complete itens in 1 search

Today, to search for items in a ticket, I need to consult several different APIs.
For example, if I first need the list of all active tickets in a queue, I do the search in the API:
‘https://URL/REST/2.0/tickets?query=Queue =‘queuename’ AND Status=’‘ACTIVE
So far so good. Then I get the list of tickets, and I need to list the fields of each ticket in this list, that is, after scanning the list, I call the API https://URL/REST/2.0/ticket/:id
and this is where the problems begin, because in this API I can only get the fields Subject, Status, creation date, start and end, classification, and origin, which are items that exist in CustomFields. However, I need more information, such as the name of the queue, and for that I need to call another API https://URL/REST/2.0/queue/:id
Another piece of information I need is the ticket’s replies and comments, and to get this I first need to call the History API https://URL/REST/2.0/ticket/:id/history , then for each item, scan an array of transactions in the API https://URL/REST/2.0/transaction/:idtransaction , and then for each transaction scan and make the query in another API https://URL/REST/2.0/attachment/:idattachment , and only then be able to read the content (in base64), which I still have to convert to text, to know the content of the ticket.

Wouldn’t it be possible to have a simplified way of making the API call, for example https://URL/REST/2.0/ticket/:id , and already get all the information I need?

1 Like

You should be able to get the queue name by expanding that field when querying tickets. Make sure your query params look like:
fields=Subject,Status,Queue and
fields[Queue]=Name,Description