Rest api with java » History » Version 17
Alex Last, 2015-02-07 01:49
moved legacy libraries to "other" section because they are not useful to today's users.
| 1 | 1 | Jean-Philippe Lang | h1. Using the REST API with Java |
|---|---|---|---|
| 2 | 2 | Alex Last | |
| 3 | 1 | Jean-Philippe Lang | h2. Redmine Java API library from taskadapter |
| 4 | |||
| 5 | "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) |
||
| 6 | |||
| 7 | 14 | Terence Mill | Sample usage: |
| 8 | 1 | Jean-Philippe Lang | |
| 9 | |||
| 10 | 17 | Alex Last | <pre> |
| 11 | String uri = "https://www.hostedredmine.com"; |
||
| 12 | String apiAccessKey = "a3221bfcef5750219bd0a2df69519416dba17fc9"; |
||
| 13 | String projectKey = "taskconnector-test"; |
||
| 14 | Integer queryId = null; // any |
||
| 15 | 1 | Jean-Philippe Lang | |
| 16 | 17 | Alex Last | RedmineManager mgr = RedmineManagerFactory.createWithApiKey(uri, apiAccessKey); |
| 17 | IssueManager issueManager = mgr.getIssueManager(); |
||
| 18 | List<Issue> issues = issueManager.getIssues(projectKey, queryId); |
||
| 19 | for (Issue issue : issues) { |
||
| 20 | System.out.println(issue.toString()); |
||
| 21 | } |
||
| 22 | 15 | Alex Last | |
| 23 | 17 | Alex Last | // Create issue |
| 24 | Issue issueToCreate = IssueFactory.createWithSubject("some subject"); |
||
| 25 | Issue createdIssue = issueManager.createIssue(projectKey , issueToCreate); |
||
| 26 | 15 | Alex Last | |
| 27 | 17 | Alex Last | // Get issue by ID: |
| 28 | Issue issue = issueManager.getIssueById(123); |
||
| 29 | 15 | Alex Last | </pre> |
| 30 | 17 | Alex Last | |
| 31 | |||
| 32 | h2. Older (legacy) libraries: |
||
| 33 | |||
| 34 | h3. Jredmine |
||
| 35 | |||
| 36 | - last release was in 2009. |
||
| 37 | "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) |
||
| 38 | |||
| 39 | h3. redmine-jconnector |
||
| 40 | |||
| 41 | - only support old Redmine (until 1.4) |
||
| 42 | "redmine-jconnector":https://code.google.com/p/redmine-jconnector/ |