Postman api url added below.
Present code :
let baseUrl = "abc.com/search/"
let param = [
"page":"1",
"size":"5",
"sortBy":"profile_locality"
]
let headers = [
"Content-Type": "application/json"
]
Alamofire.SessionManager.default.request("(baseUrl)field", method: .post,parameters: param, encoding: JSONEncoding.default, headers: headers).responseJSON { response in
print(response.request ?? "no request") // original URL request
if(response.response?.statusCode != nil){
print("done")
if self.checkResponse(response.response!.statusCode){
let json = JSON(data: response.data!)
//print("at_LeadStop json (json)")
return completionHandler(json, false)
} else {
return completionHandler(JSON.null, true)
}
} else {
print("gone")
return completionHandler(JSON.null, true)
}}
I don't know how to add body request through this code. Please help me to slove this problem.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…