title: How to POST request in Swift
body: <p>I have this API <a href="http://my-api.mydoctorfinder.com/" rel="nofollow">http://my-api.mydoctorfinder.com/</a>
  that will return a bool value depending on the email and password you have entered.</p>
  
  <p>My problem is it will always return false despite using the correct email and password.</p>
  
  <p>I was thinking that I might have not sent the right parameter since I created a dictionary containing the email and password. Then passed it on NSJSONSerialization.dataWithJSONObject method</p>
  
  <p>By the way, I was using SwiftyJson.</p>
  
  <p>This is my code</p>
  
  <pre><code>//creates a dictionary and calls the PostRequest method
  func attemptLogIn( email: String, password: String) {
      let route = loggerURL
      let body: [String:String] = ["email":email, "password":password]
      makeHTTPPostRequest(route, body: body)
  }
  
  //performs post request
  private func makeHTTPPostRequest(path: String, body: [String: AnyObject]) {
      let request = NSMutableURLRequest(URL: NSURL(string: path)!)
  
      // Set the method to POST
      request.HTTPMethod = "POST"
  
      do {
          // Set the POST body for the request
          let jsonBody = try NSJSONSerialization.dataWithJSONObject(body, options: .PrettyPrinted)
          request.HTTPBody = jsonBody
          let session = NSURLSession.sharedSession()
  
          let task = session.dataTaskWithRequest(request, completionHandler: {data, response, error -&gt; Void in
              if let jsonData = data {
                  let json:JSON = JSON(data: jsonData)
                  //onCompletion(json, nil)
                  print("The Response: ")
                  print(json)
              } else {
                  //onCompletion(nil, error)
                  print("The Response: ")
                  print("Hello")
              }
          })
          task.resume()
      } catch {
          // Create your personal error
          //onCompletion(nil, nil)
      }
  }
  </code></pre>