taskadapter / redmine-java-api

Redmine Java API
Apache License 2.0
269 stars 162 forks source link

Raw access to json results #272

Closed albfan closed 6 years ago

albfan commented 8 years ago

As a way to easily debug or access to bleeding edge functionality, raw access to responses can be helpful.

Uses:

https://github.com/albfan/redmine-java-api/commit/6785bc5369827e7d63a8657ad81a2d465d966545

I know it is indeed against the objetives of redmine-java-api, but I can ressist to have this backdoor access, please consider it.

alexeyOnGitHub commented 8 years ago

if you just want to debug json response, you can do it in a debugger where you can put breakpoints. also, you can enable debug level logging and the json response will be printed out. see https://github.com/taskadapter/redmine-java-api/blob/master/src/main/java/com/taskadapter/redmineapi/internal/Transport.java#L354

I would not recommend adding this code just for the purpose of debugging.

ancadenisa commented 7 years ago

+1 Debugging does not help in my situation. It is true that true debugging to that specific line, I came to the conclusion that i need a value that is only found there, in the response variable. Then, the response var is bypassed to other methods that build the Issue object and ignore that specific value. It would have been very useful if I could somehow access the raw response.

dannychase2004 commented 7 years ago

+1 I actually need this functionality as well, to return the list of issues to my angular front-end app as JSON. At this point, it's looking like I'll just need to bypass this lib and just use the rest interface directly? Can someone help on how I would get to the JSON results?

dannychase2004 commented 7 years ago

I didn't realize before my post, how easy this was just getting directly from the API:

@RequestMapping(value = "/getIssueList", params={"projectIdent"}, method = RequestMethod.GET)
public ResponseEntity<String> getIssueList(@RequestParam String projectIdent) {
    String uri = "http://site.com/issues.json?apiKey=04033a01597fda74b4d9fcafc38b47d68b43d10f&projectIdent=myproject";
    RestTemplate restTemplate = new RestTemplate();
    String result = restTemplate.getForObject(uri, String.class);
    return new ResponseEntity<String>(result,HttpStatus.OK);
}
alexeyOnGitHub commented 7 years ago

you are welcome to submit a PR with docs improvement, however you think it would be useful to describe this.

alexeyOnGitHub commented 6 years ago

added https://github.com/taskadapter/redmine-java-api/commit/0c213b44b9e5f05dc61316e742e92fe886964cb7 let me know if this is useful. if you need more than just json results for a Get request (mostly for debug), then this would require additional changes. feel free to propose a PR with those if you think that is useful.