title: How to call rest web service from swift
body: <p>I am trying to follow a tutorial - which failed and having found some code on stack over flow <a href="https://stackoverflow.com/questions/24321165/make-rest-api-call-in-swift">Make REST API call in Swift</a> decided to try this approach instead. The following code is a copy and paste (I know!)  with a change of URL yet I seem to be getting an error printed to the console rather than the JSON - the error being largely unhelpful - <code>0x0000000000000000</code></p>
  
  <p>The JSON appears to print to the browser window so I am not fully sure what might be wrong with this approach? Please could someone provide some help as to why this might not be working?</p>
  
  <p>Thanks</p>
  
  <pre><code>    var url : String = "http://www.flickr.com/services/rest/?method=flickr.test.echo&amp;format=json&amp;api_key=d6e995dee02d313a28ed4b799a09b869"
      var request : NSMutableURLRequest = NSMutableURLRequest()
      request.URL = NSURL(string: url)
      request.HTTPMethod = "GET"
  
      NSURLConnection.sendAsynchronousRequest(request, queue: NSOperationQueue(), completionHandler:{ (response:NSURLResponse!, data: NSData!, error: NSError!) -&gt; Void in
          var error: AutoreleasingUnsafeMutablePointer&lt;NSError?&gt; = nil
          let jsonResult: NSDictionary! = NSJSONSerialization.JSONObjectWithData(data, options:NSJSONReadingOptions.MutableContainers, error: error) as? NSDictionary
  
          if (jsonResult != nil) {
              println(jsonResult);
          } else {
              // couldn't load JSON, look at error
              println(error);
          }
      })
  </code></pre>