I search 100s of posts on StackOverflow but can\'t find any correct answer can anyone help me to solve this mystery.
let param : [String : Any]= [
\"Serv
You can use in this way
let customerTckt:[String:Any] = ["RequestID" : requestID ,
"TaskID" : taskID ,
"Description" : comments ,
"TicketTypeID" : 3 ,
"CustomerID" : customerID ,
"PriorityID" : 3 ,
"CustomerTPPID" : TTPIDArray ]
let param : [String : Any] = ["ServiceReqID" : 1 ,
"WebUsersID" : customerID,
"FirstName" : userName,
"LastName" : "" ,
"Company":self.profileValues.customerCompanyName ,
"City" : self.profileValues.customerCityName ,
"Email" : self.profileValues.customerEmail ,
"ContactNo" : self.profileValues.customerContactNumber ,
"Country" : "Pakistan" ,
"PackageChange" : 0 ,
"AddressChange" : 0,
"TelInternetVAS" : 0 ,
"Others" : 0 ,
"Comments" : comments ,
"CSAFNO" : self.profileValues.customerCSAFNo,
"SecondaryContactNo" : "" ,
"CustomerTicket" :customerTckt]
func postserviceRequestFeedback(url : String , parameter : [String : Any] , tiket : tiket ){
Alamofire.request(url, method : .post , parameters : parameter , headers :
HTTPHeaders).responseJSON { (response) in
if response.result.isSuccess{}}
Thanks to all, I solve This problem. Here is the step by step solution to this question. 1)
Alamofire.request(url, method : .post , parameters : parameter , encoding : JSONEncoding.default, headers : tiket ).responseJSON { (response) in
if response.result.isSuccess{
let responseJoson : JSON = JSON(response.result.value!)
print(responseJoson)
}
encoding is very important here. Don't skip this. Step 2)
func apiCall(){
let customerTckt:[String:Any] = ["RequestID" : requestID ,
"TaskID" : taskID ,
"Description" : comments ,
"TicketTypeID" : 3 ,
"CustomerID" : customerID ,
"PriorityID" : 3 ,
"CustomerTPPID" : TTPIDArray ]
let param : [String : Any] = ["ServiceReqID" : 1 ,
"WebUsersID" : customerID,
"FirstName" : userName,
"LastName" : "" ,
"Company":self.profileValues.customerCompanyName ,
"City" : self.profileValues.customerCityName ,
"Email" : self.profileValues.customerEmail ,
"ContactNo" : self.profileValues.customerContactNumber ,
"Country" : "Pakistan" ,
"PackageChange" : 0 ,
"AddressChange" : 0,
"TelInternetVAS" : 0 ,
"Others" : 0 ,
"Comments" : comments ,
"CSAFNO" : self.profileValues.customerCSAFNo,
"SecondaryContactNo" : "" ,
"CustomerTicket" :customerTckt]
let userToken: HTTPHeaders = [
"Authorization": "bearer \(accessToken)",
"Content-Type": "application/json"
]
postserviceRequestFeedback(url: postRequestFeedbackUrl, parameter: param , tiket: userToken)
}
Don't skip "Content-Type" to application/json