title: How to set up a GET-Response in Groovy using HTTPBuilder
body: <p>I have several issues stored in my YouTrack Server and I would like to extract those issues and pack the information in Strings. </p>
  
  <p>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):</p>
  
  <p>Going by <a href="https://github.com/jgritman/httpbuilder/wiki/GET-Examples" rel="nofollow">this website</a> and <a href="https://confluence.jetbrains.com/display/YTD6/Export+All+Issues+from+a+Project" rel="nofollow">this</a></p>
  
  <p>I would expect my code to look something like this:</p>
  
  <pre><code>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 -&gt;
  ....        
          // This gap has to be filled somehow,        
          // so that I have a JSONObject or JSONArray, I can work with. 
  ....
        }
        println 'Response data: -----'
        System.out &lt;&lt; reader
        println '\n--------------------'
      }
      String str; // this is the important String containing the data
  </code></pre>
  
  <p>Any constructive advice, answer or comment is appreciated.     </p>
  
  <p>The response then will look like this:</p>
  
  <pre><code>&lt;issues&gt;
   &lt;issue&gt;
    &lt;comment created="1277899067543" text="is it something wrong?" author="root"/&gt;
    &lt;field name="numberInProject"&gt;&lt;value&gt;0&lt;/value&gt;&lt;/field&gt;
    &lt;field name="summary"&gt;&lt;value&gt;susjs&lt;/value&gt;&lt;/field&gt;
    &lt;field name="priority"&gt;&lt;value&gt;1&lt;/value&gt;&lt;/field&gt;
    &lt;field name="description"&gt;&lt;value&gt;at jsjsjsj.mps.E.java at line 12&lt;/value&gt;&lt;/field&gt;
    &lt;field name="created"&gt;&lt;value&gt;1277392628191&lt;/value&gt;&lt;/field&gt;
    &lt;field name="updated"&gt;&lt;value&gt;1277399118476&lt;/value&gt;&lt;/field&gt;
    &lt;field name="reporterName"&gt;&lt;value&gt;root&lt;/value&gt;&lt;/field&gt;
    &lt;field name="updaterName"&gt;&lt;value&gt;root&lt;/value&gt;&lt;/field&gt;
    &lt;field name="state"&gt;&lt;value&gt;Submitted&lt;/value&gt;&lt;/field&gt;
    &lt;field name="subsystem"&gt;&lt;value&gt;No subsystem&lt;/value&gt;&lt;/field&gt;
    &lt;field name="fixedInBuild"&gt;&lt;value&gt;Next build&lt;/value&gt;&lt;/field&gt;
    &lt;field name="permittedGroup"&gt;&lt;value&gt;All Users&lt;/value&gt;&lt;/field&gt;
   &lt;/issue&gt;
  &lt;/issues&gt;
  </code></pre>