It's all about the answers!

Ask a question

How to get Stream, Component, Workspace using server api.

Anurag Patel (21363) | asked Oct 05 '17, 7:03 a.m.

Hi All,

I am trying to read the Stream, component , workspace, etc using server api.
It is possible to read using server api.
Please provide useful links for accessing Stream, component , workspace, etc using server api.
It is possible to read using server api.

Accepted answer

permanent link
Luca Martinucci (1.0k294112) | answered Oct 05 '17, 7:38 a.m.

What is your starting point?

I mean, when server API are invoked in a plugin, you are performing an action.
Anyway, you can retrieve a stream, or a workspace, that has a specific name with this code:

IWorkspaceHandle workspaceHandle = null;
IScmQueryService scmQueryService = getService(IScmQueryService.class);
IWorkspaceSearchCriteria criteria = IWorkspaceSearchCriteria.FACTORY.newInstance();
List<IWorkspaceHandle> workspaceHandles = scmQueryService.findWorkspaces(criteria, Integer.MAX_VALUE, repositoryProgressMonitorHandle).getItemHandles();
if (!workspaceHandles.isEmpty()) {
workspaceHandle = workspaceHandles.get(0);
return workspaceHandle;

If you are dealing with change sets (a typical situation during delivery or checkin), you can easily retrieve the component it belongs to:


I hope that these snippets help.

Anurag Patel selected this answer as the correct answer

One other answer

permanent link
Ralph Schoon (63.1k33646) | answered Oct 05 '17, 7:55 a.m.

 Since this totally depends on what data you have available and what the server API context is, there is no reasonable way to answer. 

I have explained some of the SCM API in the posts
Note, dependent on the post it is client or common or server API. In the server you can only use Common and Server API (look for common or server in the package name, avoid client or rcp in the package names).

Maybe there is more to answer, once you care to provide what you want to do, where and why. See: How should I ask a question in the Forum if I want to receive useful answers?

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.