问题
I’m trying to use the Rally Java REST API - https://github.com/RallyTools/RallyRestToolkitForJava. How can I create a new project in my defined workspace? I am not able to find anything useful, any help would be much appreciated.
By referring the documentation, i tried the below code, but the project is not created in the Rally
RallyRestApi rallyService = new RallyRestApi(new URI(rallyURL), userName, password);
rallyService.setApplicationName("RallyRestExample");
rallyService.setWsapiVersion("v2.0");
JsonObject newProject = new JsonObject();
newProject.addProperty("Name", "Rally Rest Sample");
newProject.addProperty("Description", "Java Rally Rest API");
newProject.addProperty("State", "Open");
newProject.addProperty("Owner", "Karthi");
newProject.addProperty("Workspace", "/workspace/XXX");
CreateRequest createRequest = new CreateRequest("Project", newProject);
CreateResponse createResponse = rallyService.create(createRequest);
Thanks Karthi
回答1:
There is a user guide in GitHub here. This walks you through how to set up a project and how to use methods provided to you by the API.
There is also full API Documentation here.
On the GitHub page, it also gives you a link to the Web Services API documentation, but you will need a Rally login to view this.
- Create a new Java Project
- Make sure you have all the required jars (listed in the documentation) in the Java Project
- Add the rally-rest-api dependency into your pom.xml (steps listed in documentation)
- Instantiate a new RallyRestAPI object by using...
RallyRestApi restApi = new RallyRestApi(new URI("https://rally1.rallydev.com"), "user@company.com", "password");
Then use restApi
to use the provided methods from the documentation.
回答2:
I think you should not use the property newProject.addProperty("Workspace", "/workspace/XXX");
and newProject.addProperty("Owner", "Karthi");
with values like "/workspace/XXX"
and "Karthi"
. Instead you need to provide it with the object ID of respective workspace and owner.
来源:https://stackoverflow.com/questions/20379976/create-a-project-in-the-defined-workspace-using-rally-java-restapi