let url = "192.168.1.1/api/project"
var header = [String:String]()
header["accept"] = "aplication/json"
header["key"] = "David"
let reqParam = ["project":["title":"Test Title","description":"Test description for new project","priority":false,"category_id":1,"location_id":1]]
Alamofire.upload(multipartFormData: { multipartFormData in
for (key, value) in reqParam{
do{
let data = try JSONSerialization.data(withJSONObject: value, options: .prettyPrinted)
multipartFormData.append(data, withName: key)
}catch(let err){
print(err.localizedDescription)
}
}
},usingThreshold:UInt64.init(),
to: url,
method: .post,
headers: ["Content-Type": "multipart/form-data"],
encodingCompletion: { (result) in
})
9
solved How to make this HTTP Post request using alamofire? [closed]