Is it possible to retrieve a specific history entry from the work item through the REST API?
Here is the scenario:
There is a tool built client using RTC REST API. This tool retrieves the work items from a given time frame and records them in an external database. It is required to retrieve the work item history along with some other attributes.
Whenever a work item is retrieved, history is comprised of all entries.
The question is: is it possible to retrieve a specific history entry? What we want to achieve is a delta update in the work item history in the external database. So let's say a work item has 10 history entries. Through the tool, the work item gets recorded in the external database. After that, the work item was changed, and a 11th history entry was created in RTC. We are able to update the work item in the external database, but instead of recording all history entries over again, we want to record only the 11th history entry. Is this possible to achieve through the REST API?
There is a tool built client using RTC REST API. This tool retrieves the work items from a given time frame and records them in an external database. It is required to retrieve the work item history along with some other attributes.
Whenever a work item is retrieved, history is comprised of all entries.
The question is: is it possible to retrieve a specific history entry? What we want to achieve is a delta update in the work item history in the external database. So let's say a work item has 10 history entries. Through the tool, the work item gets recorded in the external database. After that, the work item was changed, and a 11th history entry was created in RTC. We are able to update the work item in the external database, but instead of recording all history entries over again, we want to record only the 11th history entry. Is this possible to achieve through the REST API?
Accepted answer
According to the REST API:
"itemHistory (type: com.ibm.team.workitem.WorkItem, maxOccurs: unbounded). A collection of zero or more WorkItem elements, representing the entire history of the work item. Each state the work item has ever been in is reflected in this history list. "
This means you should be able to perform the same filtering mechanisms on the historic versions of the workitem as you can on the current version. Sure enough a query such as the one below will only return the itemHistory records modified since 2014-05-01. You can use this mechanism to create a "delta" pull for your external repository, only pulling itemHistory records that have been created since your last pull.
https://<server:port>/ccm/rpt/repository/workitem?fields=workitem/workItem/itemHistory[modified > 2014-05-01T01:00:00.000-0500]/*/*/*
"itemHistory (type: com.ibm.team.workitem.WorkItem, maxOccurs: unbounded). A collection of zero or more WorkItem elements, representing the entire history of the work item. Each state the work item has ever been in is reflected in this history list. "
This means you should be able to perform the same filtering mechanisms on the historic versions of the workitem as you can on the current version. Sure enough a query such as the one below will only return the itemHistory records modified since 2014-05-01. You can use this mechanism to create a "delta" pull for your external repository, only pulling itemHistory records that have been created since your last pull.
https://<server:port>/ccm/rpt/repository/workitem?fields=workitem/workItem/itemHistory[modified > 2014-05-01T01:00:00.000-0500]/*/*/*
One other answer
Hi. When I run this query, all I get returned is:
<workItem />
<workItem />
<workItem />
<workItem />
<workItem />
<workItem />
What am I missing so that I actually get some fields returned in the response?! FYI, my query is:
https://<server:port>/ccm/rpt/repository/workitem?fields=workitem/workItem/itemHistory[modified > 2014-09-11T10:00:28.000-0000]/*