I have several issues stored in my YouTrack Server and I would like to extract those issues and pack the information in Strings.
I already worked with the RESTClient, however I got bad output and thus want to try a different way to extract the issues using HttpBuilder and formatting the xml response in JSON. However I don't know yet, how to do that in Groovy (probably because I lack a complete, running example):
Going by this website and this
I would expect my code to look something like this:
def http = new HTTPBuilder('http://www.MyYouTrackServer.com')
AuthenticateMe() // I need that, otherwise I cannot access my server
http.get( path : 'MyIssue-25',
contentType : JSON,
query : [???'] ) { resp, reader ->
....
// This gap has to be filled somehow,
// so that I have a JSONObject or JSONArray, I can work with.
....
}
println 'Response data: -----'
System.out << reader
println '\n--------------------'
}
String str; // this is the important String containing the data
Any constructive advice, answer or comment is appreciated.
The response then will look like this:
<issues>
<issue>
<comment created="1277899067543" text="is it something wrong?" author="root"/>
<field name="numberInProject"><value>0</value></field>
<field name="summary"><value>susjs</value></field>
<field name="priority"><value>1</value></field>
<field name="description"><value>at jsjsjsj.mps.E.java at line 12</value></field>
<field name="created"><value>1277392628191</value></field>
<field name="updated"><value>1277399118476</value></field>
<field name="reporterName"><value>root</value></field>
<field name="updaterName"><value>root</value></field>
<field name="state"><value>Submitted</value></field>
<field name="subsystem"><value>No subsystem</value></field>
<field name="fixedInBuild"><value>Next build</value></field>
<field name="permittedGroup"><value>All Users</value></field>
</issue>
</issues>