Return additional fields in transactions list via REST 2.0

Is it possible to get a list of transactions for a specific ticket that includes information besides ‘id’, ‘type’, and ‘_url’? In particular I’m looking for ‘TimeTaken’.

Currently I’m using the REST 2.0 to get the list of transactions that belong to a ticket.
https://example.com/rt/REST/2.0/ticket/1/history

Then I request the details of each individual transaction so that I can get the ‘TimeTaken’ value.
https://example.com/rt/REST/2.0/transaction/427

Each call to get the transaction detail takes 1/4 to 1/2 seconds. Each ticket can have many, many transactions and these calls add up quickly. Working with even a small batch of tickets ends up taking several minutes.

Where I have this:
“items”: [
{
“id”: “427”,
“type”: “transaction”,
“_url”: “https://example.com/rt/REST/2.0/transaction/427
},
]
I’d love to have:
“items”: [
{
“id”: “427”,
“type”: “transaction”,
“_url”: “https://example.com/rt/REST/2.0/transaction/427”,
“TimeTaken”: 6
},
]

Can I specify additional fields to return?

In latest version of REST2 available on GitHub it seems to be possible with adding the “fields” GET parameter. Not sure if it works for custom fields, but seeing as you seem to need only the built-in fields, this might be exactly what you need,

1 Like

Thank you! That looks like exactly what I want. Unfortunately I’ll need to upgrade my installed version of the plugin. I was planning to do that anyway though, to fix the missing content on new ticket creation bug. Hopefully this will be a two birds, one stone situation.

For the record updating the extension to version 1.07 fixed both of my issues. I am now able to retrieve arbitrary fields (in my case ‘TimeTaken’ on a list of transactions) and I’m able to set initial ticket content when I’m creating a new ticket.

1 Like