简体   繁体   English

如何使用Swift Alamofire在REST API中发送HTML标签字符串?

[英]How can I send HTML tag string in REST API by using Swift Alamofire?

I need to send HTML string to server. 我需要将HTML字符串发送到服务器。 I am using Swift alamofire and when I try to call Rest api then getting ccs code response from server. 我正在使用Swift alamofire,当我尝试调用Rest api时,会从服务器获取ccs代码响应。 same body format used in PostMan and it's working good. 与PostMan中使用的正文格式相同,并且效果很好。

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 = "bambhroliya.bhavdip@example.com"; toname = "Bhavdip Patel";}

Response: 响应:

invalid json format. 无效的json格式。 getting css code. 获取CSS代码。 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."
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 = "bambhroliya.bhavdip@tristonsoft.com", toname = "Bhavdip Patel"] as! [String:Any]

用它作为你的参数

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Swift 3中使用Alamofire制作并发送字典数组(JSON格式)发送到服务器 - How Can I make & send array of dictionary (JSON Format ) send to server using Alamofire in swift 3 我如何从单个json值中提取字符串并将其快速附加到我的标签中(使用alamofire) - how can I fetch a string from a single json value and append it to my label in swift (using alamofire) 如何使用Alamofire和Mailgun使用Swift发送电子邮件? - How to send email using Alamofire and Mailgun with Swift? 如何使用Swift在此Alamofire函数中返回true / false? - How can I return true/false in this Alamofire function using Swift? 如何快速使用 alamofire 将任何文件上传到服务器 - How can I upload any file to server using alamofire in swift 如何在 API 请求(Alamofire)swift 5 中发送撇号('s)? - How to send Apostrophe ('s) in API request(Alamofire) swift 5? 如何快速发送令牌字符串(jwt)作为Alamofire Post请求中的Cookie? - How to send token string (jwt) as Cookie in Alamofire Post request in swift? 如何使用 Swift 将 UIImage 上传到 REST API,作为 swift3 中的“source=”参数? - How can I upload a UIImage to an REST API using Swift, as a 'source=' parameter in swift3? 如何使用swift中的POST方法使用参数和标头在Alamofire中发送请求 - How to send request in Alamofire with parameters and headers using POST method in swift 如何在 swift 5 中使用 Alamofire multipartFormData 发送数据和图像 - How to send data along with an image using Alamofire multipartFormData in swift 5
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM