You are not logged in. Click here to log in.

codeBeamer ALM

Search In Project

Search inClear

Tags:  not added yet

Example Rest API client based using .NET

The project and the source code can be downloaded here:

The executable application can be downloaded here:

Minimum requirement: .NET framework version 3.5

This application was tested under Windows 7 and 8.1.


     >CodeBeamerUnresolvedIssues.exe -e [enpoint] -u [username] -p [password] -a [user account] -t [type] -f [file name]
        -c [converter] -n [encoding] -o -d

     -u [Username]: login user account name, default is current Windows user
     -p [Password]: login user password, if no value specified then Windows session authentication is used
     -e [Endpoint]: the codeBeamer endpoint server address (eg.
     -a [user Account]: (optional) List the specified user's work items, by default the login user's work items are listed
     -t [Type]: (optional) Result file format. Possible values: tsv, csv, json, xml. Default: tsv
     -f [File name]: (optional) Generate the result into the specified file
     -c [Converter]: (optional)  Use special item converter (ext is implemented for now)
     -n [eNcoding]: (optional)  Output encoding (the list of usable encoding could be found in msdn,
         eg.: )
     -o [Only directly assigned]: (optional) Show only the directly related work items to the user (not related via the user's role
     -d [Debug]: (optional) debug mode on

     Example 1:
     CodeBeamerUnresolvedIssues.exe -e -u cbprojectadmin -p cbpass -a cbdeveloper -t json -f result.json -c ext -n windows-1250 -o -d

     This will fetch unresolved issues which directly assigned (-o) to user "cbdeveloper" (-a) using codeBeamer REST API. The request authenticate with "cbprojectadmin",
     "cbpass" pair (-u,-p), the type will be JSON (-t), and the result will be generated into (-f) a file called "result.json",
     and an extended item converted will be used (-c). The result encoding will be windows-1250. Extra information about the execution will be printed (-d).

     Example 2:
     CodeBeamerUnresolvedIssues.exe -e -u cbprojectadmin -p cbpass

     This will fetch all unresolved issues for user "cbprojectadmin" (-a not specified),
     and it will print out the result in tsv format (-t not specified, tsv is the default) to console output (-f not specified, default is the console)
     in UTF8 encoding (-n not specified, UTF8 is the default output encoding)

Output providers

Output provider generates the output from the converted (simplified) objects into a final response object. All provider have to implement the IOutputProvider interface which has only one method it is called GenerateOutput. This method has two input parameters, a list of the work items which are converted objects from REST API and an output stream writer.

During the implementation of a new provider the new object should represent the IOutputProvider interface. The following example is a simple provider that prints out all working item name as simple text:

    class FooProvider : IOutputProvider
        public void GenerateOutput(List<WorkItem> workItems, System.IO.StreamWriter writer)
            foreach (WorkItem workItem in workItems)

The new provider should be registered at the OutputProviderFactory:

    static class OutputProviderFactory
        public static IOutputProvider GetProvider(ProgramArguments arguments)
            switch (arguments.Type.ToLower())
                case "csv":
                    return new CsvProvider(";");
                case "json":
                    return new JsonProvider();
                case "xml":
                    return new XmlProvider();
                // !!! new case inserted:
                case "foo":
                    return new FooProvider();
                    // default is tsv
                    return new CsvProvider("\t");


After then the application can be executed using the new provider:

CodeBeamerUnresolvedIssues.exe -e -u cbprojectadmin -p cbpass -t foo


Work item converters can be used to convert the parsed working item object from codeBeamer (Issue) to simplified object WorkItem what represents the final application output. The following example represents how you can extend the current DefaultItemConverter with two new properties and use them automatically in the result. The new converter extends the DefaultItemConverter class (which implements the IItemConverter interface) and add two properties, status and priority:

    class ExtendedItemConverter : DefaultItemConverter

        public override WorkItem Convert(Item item)
            ExtendedWorkItem result = new ExtendedWorkItem();
            if (item != null)
                result.WorkItemId = Int32.Parse(base.getIdFromUri(item.uri));
                result.Name =;
                result.Modifier = item.modifier != null ? : "";
                result.Modified = item.modifiedAt;
                result.Submitter = item.submitter != null ? : "";
                result.Submitted = item.submittedAt;
                result.Status = item.status != null ? : "";
                result.Priority = item.priority != null ? : "";
            return result;

    public class ExtendedWorkItem : WorkItem
        public string Status { get; set; }
        public string Priority { get; set; }

The new provider should be registered in Program.cs:

        private static IItemConverter getItemConverter(ProgramArguments arguments)
            if (arguments.Converter != null)
                switch (arguments.Converter)
                    case "ext":
                        return new ExtendedItemConverter();
            return new DefaultItemConverter();

After then the application can be executed using the new converter:

CodeBeamerUnresolvedIssues.exe -e -u cbprojectadmin -p cbpass -c ext