It's all about the answers!

Ask a question

Using the REST API to get the history for a file


1
1
Peter Weller (39379) | asked May 15 '13, 1:52 a.m.
edited May 20 '13, 3:52 p.m. by Millard Ellingsworth (2.5k12431)
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

Comments

Krzysztof Kaźmierczyk commented May 15 '13, 6:10 a.m.

Good answer Arek. Thanks :)


Stephane Leroy commented May 15 '13, 8:03 a.m. | edited May 15 '13, 11:40 p.m.
JAZZ DEVELOPER

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


Peter Weller commented May 15 '13, 10:38 a.m.

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


Peter Weller commented May 15 '13, 10:38 a.m.

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

Accepted answer


permanent link
Tim Mok (6.6k38) | answered Jul 17 '13, 1:57 p.m.
JAZZ DEVELOPER
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

Comments
Nayeem M commented Mar 07 '15, 9:53 a.m. | edited Mar 07 '15, 9:53 a.m.

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


Evan Hughes commented Mar 09 '15, 2:32 p.m.
JAZZ DEVELOPER

I think Nayeem also asked this as a question


Nayeem M commented Mar 09 '15, 5:27 p.m. | edited Mar 09 '15, 5:27 p.m.

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 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.