0

I need to send HTML string to server. I am using Swift alamofire and when I try to call Rest api then getting ccs code response from server. same body format used in PostMan and it's working good.

My request body parameters:

{body = "<br/><br/>Hi Bhavdip,<br/><br/>Please find the One-Time Password (OTP) as requested through application.<br/>OTP- 123456 <br/><br/>Kindly, enter this OTP in your mobile application to authenticate your account and change phone number.<br/><br/>Kind regard,<br/>VeriDoc Global Team.";subject = "VeriDoc Global OTP for Account Verification";toaddress = "[email protected]"; toname = "Bhavdip Patel";}

Response:

invalid json format. getting css code. Param Value is

"<br/><br/>Hi Bhavdip,<br/><br/>Please find the One-Time Password (OTP) as requested through application.<br/>OTP- 123456 <br/><br/>Kindly, enter this OTP in your mobile application to authenticate your account and change phone number.<br/><br/>Kind regard,<br/>VeriDoc Global Team."
1
  • "My request body parameters:" Could you show some code on how did you get that? Also, why does it seems like being a NSDictionary and not a Swift Dictionary?
    – Larme
    Commented Sep 11, 2019 at 13:52

1 Answer 1

0
let params = [body = "<br/><br/>Hi Bhavdip,<br/><br/>Please find the One-Time Password (OTP) as requested through application.<br/>OTP- 798580 <br/><br/>Kindly, enter this OTP in your mobile application to authenticate your account and change phone number.<br/><br/>Kind regard,<br/>VeriDoc Global Team.",subject = "VeriDoc Global OTP for Account Verification",toaddress = "[email protected]", toname = "Bhavdip Patel"] as! [String:Any]

use this as your params

Not the answer you're looking for? Browse other questions tagged or ask your own question.