Can I create/update a subproject by REST api?

Added by chunlin chen over 5 years ago

hi,all
i'm trying to integrate the redmine with a process verifier system, can i create or update a subproject by REST api?
any help will be appreciated!

Replies (4)

RE: Can I create/update a subproject by REST api? - Added by chunlin chen over 5 years ago

Thank you, Alexey. I have checked out the project redmine-java-api, and tested it, it can create/update a project, but cannot create or update a subproject.

RE: Can I create/update a subproject by REST api? - Added by Alex Last over 5 years ago

take a look at this test code:

/* This tests finally PASSES after Redmine bug http://www.redmine.org/issues/8229 was fixed
*/
@Test
public void subProjectIsCreatedWithCorrectParentId() {
Project createdMainProject = null;
try {
createdMainProject = createProject();
Project subProject = createSubProject(createdMainProject);
Assert.assertEquals("Must have correct parent ID",
createdMainProject.getId(), subProject.getParentId());
} catch (Exception e) {
Assert.fail();
} finally {
if (createdMainProject != null) {
try {
mgr.deleteProject(createdMainProject.getIdentifier());
} catch (Exception e) {
Assert.fail();
}
}
}
}
private Project createProject() throws IOException, AuthenticationException, RedmineException, NotFoundException {
Project mainProject = new Project();
long id = new Date().getTime();
mainProject.setName("project" + id);
mainProject.setIdentifier("project" + id);
return mgr.createProject(mainProject);
}
private Project createSubProject(Project parent) throws IOException, AuthenticationException, RedmineException, NotFoundException {
Project project = new Project();
long id = new Date().getTime();
project.setName("sub_pr" + id);
project.setIdentifier("subpr" + id);
project.setParentId(parent.getId());
return mgr.createProject(project);
}

RE: Can I create/update a subproject by REST api? - Added by chunlin chen over 5 years ago

Thank you very much, Alexey. That is OK!

(1-4/4)