I have checked many stack overflow questions but unable to find answer for the following problem. How can I request a post api which has parameters like get api using Alamofire Swift?
Request:
http://dev.practice.com/api/v1/test/apply?id=51&social_id=2
Body:
"url": https://www.social.com/some_image_url
I have tried with the following way but it's not working:
let urlString = "http://dev.practice.com/api/v1/test/apply?id=51&social_id=2"
Alamofire.request(urlString, method: .post, parameters: ["url": "https://www.social.com/some_image_url"],encoding: JSONEncoding.httpBody, headers: header).responseJSON {
response in
switch response.result {
case .success:
print(response)
break
case .failure(let error):
print(error)
}
}