Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

Using the REST API to get the history for a file

Hi,

I am wondering whether your REST API (or even the Java API) is able to expose the history for a file? I've looked at this reports API, but it looks like it only describes the comment and the owner. If there's no API, is lscm compare the way forward?

I spotted another question which was asking exactly the same thing, but it never got an answer. Rather than reviving an old question, I thought I'd try again.

Thanks,
Peter

1

1 vote

Comments

Good answer Arek. Thanks :)

Hi,

Arkadiusz's answer addresses work-item history whereas AFAIK Peter's question was related to SCM part.

For the work-item history (little out of topic here), you could also use: https://localhost:9443/ccm/rpt/repository/workitem?fields=workitem/workItem[id=1]/(itemHistory/*)

Regards,
Stéphane

As  Stéphane mentioned, I'm after the changes for a given file, not for the workitem.

Yeah you got it right, I'm after the SCM part/the history for a given file. 


Accepted answer

Permanent link
There are scm rest calls for this but they aren't considered public API. They're subject to change so you'll have to be on top of new releases and test your rest calls.

For item history:
https://example.com:9443/ccm/service/com.ibm.team.scm.common.internal.rest.IScmRestService/history?workspaceItemId={workspace id}&componentItemId={component id}&oid=com.ibm.team.filesystem.FileItem/{item id}

If you omit the item id, it will retrieve the component history.
Peter Weller selected this answer as the correct answer

1 vote

Comments

Can you please help me with the URL framing..

https://example.com:9443/ccm/service/com.ibm.team.scm.common.internal.rest.IScmRestService/history?workspaceItemId={workspace id}&componentItemId={componentid}
&oid=com.ibm.team.filesystem.FileItem/{item id}

https://rtc.repository.com:9443/jazz/service/com.ibm.team.scm.common.internal.rest.IScmRestService/history?workspaceItemId={1017}
componentItemId={component id}

Is the workspaceItemId ID of my repository Workspace?
./scm.sh list workspaces -r $user --maximum 1000 | grep -i NADHKDH
(1017) "1_JeeCompAuto_bko" Nayeem, M NADHKDH
(1018) "1_Report.201408.caj_batch" Nayeem, M NADHKDH
what would be componentitemid?

This is location of a file for which i need the history
Workspace Name: 1_Report.201408.caj_batch
Component: java_files
File path
/source/common/com/pko/jop/common/PropertyReader.java

I was able to get the result using scm but i cant use it as repository consists of huge number of files

scm show history -r $uId -u $uname -P $pd -w $ws  --component java_files /source/common/com/pko/jop/common/PropertyReader.java

I think Nayeem also asked this as a question

Right..I did..This might be answer to my question if I am able to frame the URL


https://example.com:9443/ccm/service/com.ibm.team.scm.common.internal.rest.IScmRestService/history?workspaceItemId={workspace id}&componentItemId={componentid}
&oid=com.ibm.team.filesystem.FileItem/{item id}

https://rtc.repository.com:9443/jazz/service/com.ibm.team.scm.common.internal.rest.IScmRestService/history?workspaceItemId={1017}
componentItemId={component id}

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,950
× 1,204
× 480
× 411

Question asked: May 15 '13, 1:52 a.m.

Question was seen: 8,582 times

Last updated: Mar 09 '15, 5:27 p.m.

Confirmation Cancel Confirm