Mohamed Diaa Mohamed Diaa - 1 year ago 517
Swift Question

How to use Alamofire to send Form-data as in Postman

I want to make similar ALamofire request as Postman request shown in screenshot

I ended up that POST + Alamofire UPload + appendBodyPart(#stream: NSInputStream, length: UInt64, headers: [String: String])

will be the Answer but did not find clear example how to implement it ?

Postman screenshot

Answer Source

Your simple POST request with Alamofire should be like this

    Alamofire.request(.POST, "http:/", parameters: ["foo": "bar","key_1":"value_1"])
     .response { request, response, data, error in

You can use .responseJSON , .responseString according to your response