Project

General

Profile

Rest api with java » History » Revision 17

Revision 16 (Leonardo Pacheco, 2015-01-22 21:19) → Revision 17/19 (Alex Last, 2015-02-07 01:49)

h1. Using the REST API with Java 

 h2. Jredmine 

 "Jredmine":http://maven-site.nuiton.org/jredmine/index.html (implements its own redmine plugin and correspodnsing java client - more other/features than redmine rest api) 

 h2. redmine-jconnector 

 "redmine-jconnector":https://code.google.com/p/redmine-jconnector/ (only until redmine 1.4 using REST API) 

 h2. Redmine Java API library from taskadapter 

 "Redmine Java API library":https://github.com/taskadapter/redmine-java-api is a FREE third-party Java library that can be used to access the Redmine API. It is released under Apache 2 open-source license. (support until Redmine 2.6.0 using REST API) 

 Sample usage: 


 

 <pre> 	
     

	 String uri = "https://www.hostedredmine.com"; 
     
	 String apiAccessKey = "a3221bfcef5750219bd0a2df69519416dba17fc9"; 
     
	 String projectKey = "taskconnector-test"; 
     
	 Integer queryId = null; // any 
        
     
        
         ... 
	
         RedmineManager mgr = RedmineManagerFactory.createWithApiKey(uri, apiAccessKey); 
     
         IssueManager issueManager = mgr.getIssueManager(); 
     
         List<Issue> issues = issueManager.getIssues(projectKey, queryId); 
     
         for (Issue issue : issues) { 
             System.out.println(issue.toString()); 
         System.out.println(issue.toString()); 
     } 

     

         // Create issue 
     
	 Issue issueToCreate = IssueFactory.createWithSubject("some subject"); 
     
	 Issue createdIssue = issueManager.createIssue(projectKey , issueToCreate); 

     

         // Get issue by ID: 
     

	 Issue issue = issueManager.getIssueById(123); 
 </pre> 


 h2. Older (legacy) libraries:  

 h3. Jredmine 

 - last release was in 2009. 
 "Jredmine":http://maven-site.nuiton.org/jredmine/index.html (implements its own redmine plugin and correspodnsing java client - more other/features than redmine rest api) 

 h3. redmine-jconnector 

 - only support old Redmine (until 1.4) 
 "redmine-jconnector":https://code.google.com/p/redmine-jconnector/