title: Get JSON result with GET request and parameters with Alamofire
body: <p>This is my url String with paramaters.
  <a href="http://api.room2shop.com/api/product/GetProducts?categoryId=22&amp;filter=2&amp;pageNumber=1" rel="nofollow noreferrer">http://api.room2shop.com/api/product/GetProducts?categoryId=22&amp;filter=2&amp;pageNumber=1</a> through which I am getting my JSON data. I have AFWrapper.swift file in which I have defined function for GETrequest.</p>
  
  <pre><code>import UIKit
  import Alamofire
  import SwiftyJSON
  
  class AFWrapper: NSObject {
  
      class func requestGETURL(strURL: String, params : [String : AnyObject]?, success:(JSON) -&gt; Void, failure:(NSError) -&gt; Void) {
          Alamofire.request(.GET, strURL, parameters: params, encoding: ParameterEncoding.JSON).responseJSON { (responseObject) -&gt; Void in
  
              print(responseObject)
  
              if responseObject.result.isSuccess {
                  let resJson = JSON(responseObject.result.value!)
                  success(resJson)
              }
              if responseObject.result.isFailure {
                  let error : NSError = responseObject.result.error!
                  failure(error)
              }
  
  
             }
          }
  }
  </code></pre>
  
  <p>Now I am calling this function in my ViewController.swift file.</p>
  
  <pre><code>let strURL = "http://api.room2shop.com/api/product/GetProducts"
      let param = ["categoryId": "22", "filter": "2", "pageNumber": "1"]
      AFWrapper.requestGETURL(strURL, params: param, success: {
          (JSONResponse) -&gt; Void in
  
          if let resData = JSONResponse["ProductList"].arrayObject {
              for item in resData {
                  self.TableData.append(datastruct(add: item as! NSDictionary))
              }
  
          do
          {
              try self.read()
          }
          catch
          {
          }
          self.do_table_refresh()
      }
  
  }) {
      (error) -&gt; Void in
      print(error)
  }
  </code></pre>
  
  <p>but it is not giving me any response and giving me this error. </p>
  
  <blockquote>
    <p>FAILURE: Error Domain=NSURLErrorDomain Code=-1017 "cannot parse
    response"
    UserInfo={NSErrorFailingURLStringKey=<a href="http://api.room2shop.com/api/product/GetProducts" rel="nofollow noreferrer">http://api.room2shop.com/api/product/GetProducts</a>,
    _kCFStreamErrorCodeKey=-1, NSErrorFailingURLKey=<a href="http://api.room2shop.com/api/product/GetProducts" rel="nofollow noreferrer">http://api.room2shop.com/api/product/GetProducts</a>,
    NSLocalizedDescription=cannot parse response,
    _kCFStreamErrorDomainKey=4, NSUnderlyingError=0x78ecf180 {Error Domain=kCFErrorDomainCFNetwork Code=-1017 "(null)"
    UserInfo={_kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-1}}}
    Error Domain=NSURLErrorDomain Code=-1017 "cannot parse response"
    UserInfo={NSErrorFailingURLStringKey=<a href="http://api.room2shop.com/api/product/GetProducts" rel="nofollow noreferrer">http://api.room2shop.com/api/product/GetProducts</a>,
    _kCFStreamErrorCodeKey=-1, NSErrorFailingURLKey=<a href="http://api.room2shop.com/api/product/GetProducts" rel="nofollow noreferrer">http://api.room2shop.com/api/product/GetProducts</a>,
    NSLocalizedDescription=cannot parse response,
    _kCFStreamErrorDomainKey=4, NSUnderlyingError=0x78ecf180 {Error Domain=kCFErrorDomainCFNetwork Code=-1017 "(null)"
    UserInfo={_kCFStreamErrorDomainKey=4, _kCFStreamErrorCodeKey=-1}}}</p>
  </blockquote>
  
  <p>Can anyone tell me what am I doing wrong? I have seached this link but not getting what is wrong. <a href="https://stackoverflow.com/questions/32595517/url-encode-alamofire-get-params-with-swiftyjson">URL Encode Alamofire GET params with SwiftyJSON</a> </p>