I am unable to implement the JSON using DELETE
method to get data from server. Is this the right way to implement delete method, if not can anyone help me?
Here is my code
func deleteWishListItemsDownloadJsonWithURl(deleteApi: String){
let url = URL(string: deleteApi)
var request = URLRequest(url: url! as URL)
request.httpMethod = "DELETE"
let task = URLSession.shared.dataTask(with: request) { (data, response, error) in
if error != nil { print(error!); return }
do {
if let jsonObj = try JSONSerialization.jsonObject(with: data!) as? String {
print(jsonObj)
DispatchQueue.main.async {
self.tableDetails.reloadData()
}
}
} catch {
print(error)
}
}
task.resume()
}