enter image description hereenter image description hereenter image description hereI am using Alamofire. I am stuck in posting the post request. I have a post body which is -
[
{
"siteName": "lab1",
"locationCode": "111",
"locationName": "test1"
}
]
How should I make the request call? I am doing -
let parameters: Parameters = [
"siteName": "lab",
"locationCode": "1156",
"locationName": "123test"
]
Alamofire.request(URLStr, method: .post, parameters: parameters , encoding: JSONEncoding.default, headers: headers).responseJSON { response in
print("Request: \(String(describing: response.request))") // original url request
print("Response: \(String(describing: response.response))") // http url response
print("Result: \(response.result)") // response serialization result
if let json = response.result.value {
print("JSON: \(json)") // serialized json response
sucessHandler(json)
}
if let data = response.data, let utf8Text = String(data: data, encoding: .utf8) {
print("Data: \(utf8Text)") // original server data as UTF8 string
failureHandler(response.error)
}
}