So here is the thing, Im trying to use Almofire to post header and a body (as string) to an API.
_ = Alamofire.request("http://myurl", method: .post, parameters: param, encoding: JSONEncoding.default, headers: ["Authorization" : token])
.responseJSON { response in
switch response.result {
case .success(let data):
let json = JSON(data)
print(json)
case .failure( let error):
_ = SweetAlert().showAlert("Data Error!", subTitle: "Something Is Wrong!! Please contact Support", style: AlertStyle.warning)
}}
this works fine..
However I cant figure out how to pass a body string (this is the ID i pass to get data) API does not accept any parametrs (as key value or json) unless if it is just a String (ID). any help would be greatly appreciated.