Announcement Announcement Module
Collapse
No announcement yet.
Using RestTemplate to get Redmine Data. Help is needed Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using RestTemplate to get Redmine Data. Help is needed

    Greetings,

    I am very new to Spring Tool Suit and I got nearly zero experience in JDBC or Rest API itself.
    As part of my training on this, my task is know to make it possible to get Redmine Data via RestAPI.

    And this is my Problem, I am very very new to this kind of operation and feels alone in the woods. So Many informations but none who hits my problem strait enough to help me. (And yes you think right it is my first contact with redmine too).

    But from the Beginning.

    My idea was I connect to the Application using the RestTemplate Funktion to connect to the server an "save" the Json Data in a Bufferedreader. The next step should be to handle this to Jackson an save the created POJOs into a javalist for future use.

    My first big problem is know that I am feels to stupid to connect the Server. Redmine shows some sample code for Java but i am unable to transfer this to Spring (and using Spring onboard options). The Sample code looks like this:

    Code:
    import java.io.IOException;
    import java.net.URISyntaxException;
    import java.util.List;
    import com.taskadapter.redmineapi.RedmineManager;
    import com.taskadapter.redmineapi.bean.Issue;
    
    public class Simple {
        private static String redmineHost = "https://www.hostedredmine.com";
        private static String apiAccessKey = "a3221bfcef5750219bd0a2df69519416dba17fc9";
        private static String projectKey = "taskconnector-test";
        private static Integer queryId = null; // any
    
        public static void main(String[] args) {
            RedmineManager mgr = new RedmineManager(redmineHost, apiAccessKey);
            try {
                tryGetIssues(mgr);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    
        private static void tryGetIssues(RedmineManager mgr) throws Exception {
            List<Issue> issues = mgr.getIssues(projectKey, queryId);
            for (Issue issue : issues) {
                System.out.println(issue.toString());
            }
        }
    }

    I am very confused at the moment and need some advice to get a solution for my problem.

    at the moment I stuck at:
    Code:
             String redmineHost = "https://www.hostedredmine.com";
             String apiAccessKey = "a3221bfcef5750219bd0a2df69519416dba17fc9";
             String projectKey = "taskconnector-test";
             Integer queryId = null; // any
    	    
             RestTemplate rt = new RestTemplate();
             BufferedReader redmineBufferedReader = new BufferedReader(rt.getForEntity(redmineHost, JSON, apiAccessKey));
    And getting an error on restTemplate appears: "RestTemplate cannot be resolved to a type" but I take the import:

    Code:
    import org.springframework.web.client;
    maybe this was wrong, but i doesn't see the wood at the moment there are so many threes.

    I was very thankful for any help.
Working...
X