let urlString = " "
let json = "{\"offset\":0,\"limit\":5}"
let url = URL(string: urlString)!
let jsonData = json.data(using: .utf8, allowLossyConversion: false)!
var request = URLRequest(url: url)
request.httpMethod = HTTPMethod.post.rawValue
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = jsonData
Alamofire.request(request).responseJSON {
(response) in
if response.result.isSuccess {
let json = JSON(response.data!)
print(json)
} else {
}
}
网友评论