title: How to use Alamofire 4 SessionManager?
body: <p>I was using Alamofire 3.4 in Swift 2.3 and I need to update my code to Swift 3 and Alamofire 4.
  I was using Alamofire's Manager to do a POST in a url. I read the documentation about SessionManager and I understand that the request uses the method .GET.  </p>
  
  <p>I was using Manager .Response() to get the callback from the request, now that's changed in SessionManager. </p>
  
  <p>How do I make a POST method using SessionManager? And how do I get the response from the request?</p>
  
  <p>This is my original code:</p>
  
  <pre><code>import UIKit
  import AEXML
  import Alamofire
  
  class Request: NSObject {
  
      internal typealias RequestCompletion = (statusCode: Int?, error:NSError?) -&gt; ()
      private var completionBlock: RequestCompletion!
  
      var serverTrustPolicy: ServerTrustPolicy!
      var serverTrustPolicies: [String: ServerTrustPolicy]!
      var afManager: Manager!
  
      func buildBdRequest(ip : String, serviceStr : String, completionBlock:RequestCompletion){
         let url = getURL(ip, service: serviceStr)
          configureAlamoFireSSLPinningWithCertificateData()
          makeAlamofireRequest(url)
  
          self.completionBlock = completionBlock
      }
  
      func makeAlamofireRequest(url : String){
          self.afManager.request(.POST, url)
              .validate(statusCode: 200..&lt;300)
              .response { request, response, data, error in
  
                  print("data - &gt; \n    \(data.debugDescription) \n")
                  print("response - &gt;\n    \(response.debugDescription) \n")
                  print("error - &gt; \n    \(error.debugDescription) \n")
  
                  var statusCode = 0
  
                  if response != nil {
                      statusCode = (response?.statusCode)!
                  }
                     self.completionBlock(statusCode: statusCode, error: error)
          }
  
      }
  
  
      private func getURL(ip : String, service: String) -&gt; String{
          return ip + service;
      }
  
      func configureAlamoFireSSLPinningWithCertificateData() {
          self.serverTrustPolicies = [ :
              //            "github.com": self.serverTrustPolicy!
          ]
  
          self.afManager = Manager(
              configuration: NSURLSessionConfiguration.defaultSessionConfiguration()
          )
      }
  }
  </code></pre>