Rally.RestApi Namespace |
This is the primary namespace for the Rally Rest API for DotNet.
Library | Required | Used For |
---|---|---|
Rally.RestApi.dll | Yes | Communication with Rally |
Rally.RestApi.UiForWinforms.dll | No | Provides a UI for Winforms applications |
Rally.RestApi.UiForWpf.dll | No | Provides a UI for WPF applications Can be used by Winforms applications that need IDP based SSO |
This sample code snippet shows how the Rally Rest API can be used by a console application:
string username = "paul@acme.com"; string password = "Just4Rally"; string serverUrl = "https://preview.rallydev.com"; // Initialize the REST API. You can specify a web service version if needed in the constructor. RallyRestApi restApi = new RallyRestApi(); restApi.Authenticate(username, password, serverUrl, proxy: null, allowSSO: false); //Create an item DynamicJsonObject toCreate = new DynamicJsonObject(); toCreate["Name"] = "My Defect"; CreateResult createResult = restApi.Create("defect", toCreate); //Update the item DynamicJsonObject toUpdate = new DynamicJsonObject(); toUpdate["Description"] = "This is my defect."; OperationResult updateResult = restApi.Update(createResult.Reference, toUpdate); //Get the item DynamicJsonObject item = restApi.GetByReference(createResult.Reference); //Query for items Request request = new Request("defect"); request.Fetch = new List<string>() { "Name", "Description", "FormattedID" }; request.Query = new Query("Name", Query.Operator.Equals, "My Defect"); QueryResult queryResult = restApi.Query(request); foreach (var result in queryResult.Results) { //Process item as needed } //Delete the item OperationResult deleteResult = restApi.Delete(createResult.Reference);
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.diagnostics> <trace autoflush="true" indentsize="2"> <listeners> <add name="RallyRestApiUiSample" type="System.Diagnostics.TextWriterTraceListener initializeData="RallyRestApiUiSample.log" /> <remove name="Defaultlisteners> </trace> </system.diagnostics> </configuration>
If you are upgrading from the 2.x series of the Rally Rest API for DotNet, the following major changes are known:
This example shows the changes to authentication for a console application. For UI based applications, please see the documentation for the Rally.RestApi.UiForWpf Namespace for extended examples.
// Old authentication in constructor RallyRestApi restApi = new RallyRestApi("user@sandbox.com", "secret", "https://sandbox.rallydev.com", "v2.0"); // New authentication method RallyRestApi restApi = new RallyRestApi(webServiceVersion: "v2.0"); restApi.Authenticate("user@sandbox.com", "secret", "https://sandbox.rallydev.com", allowSSO: false);
Class | Description | |
---|---|---|
Query |
This class represents a filter
for query operations.
|
|
RallyRestApi |
The main interface to the Rally REST API
|
|
Ref |
The Ref class contains a set of utility methods
for working with refs.
|
|
Request |
Represents a request to be sent to Rally
|
Enumeration | Description | |
---|---|---|
QueryOperator |
The available query operators
|
|
RallyRestApiAuthenticationResult |
Enumeration of the different authentication results that may occur.
|
|
RallyRestApiHeaderType |
Enumeration of the valid HTTP headers that
may be passed on REST requests
|