Print Alamofire request body

For Swift 3+

print(NSString(data: (response.request?.httpBody)!, encoding: String.Encoding.utf8.rawValue))

Swift 5

print(response.debugDescription)

The answer to your first question is,

println("request body: \(request.HTTPBody)")

As far as your 2nd question goes, there's a whole section on API Parameter Abstraction as well as CRUD & Authorization on the Alamofire main page.


Added the below extension for the Request class for printing the logs.

extension Request {
    public func debugLog() -> Self {
        #if DEBUG
            debugPrint("=======================================")
            debugPrint(self)
            debugPrint("=======================================")
        #endif
        return self
    }
}

To use the extension, just use debugLog() after defining your request, like so:

Alamofire.request(url).debugLog()
            .responseJSON( completionHandler: { response in
   })

reference url : link