Using the REST API to get the history for a file
Accepted answer
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.
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}
Comments
Arkadiusz Kołodziejski
May 15 '13, 11:39 p.m.server/ccm/service/com.ibm.team.workitem.common.internal.rest.IWorkItemRestService/workItemDTO2?id={workitem id here}&includeAttributes=false&includeLinks=false&includeApprovals=false&includeHistory=true
Krzysztof Kaźmierczyk
May 15 '13, 6:10 a.m.Good answer Arek. Thanks :)
Stephane Leroy
JAZZ DEVELOPER May 15 '13, 11:40 p.m.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
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
May 15 '13, 10:38 a.m.Yeah you got it right, I'm after the SCM part/the history for a given file.