I'm Receiving Response from api using post method like this
'Success{
shortlink = pAHJt7;
status = 200;
} '
I want to use only shortlink with my url to share using deep linking concept.
Here is my code of post method in which I'm getting response from api
func postRequest(latitude:Double,longitude:Double) {
guard let url = URL(string: "http://i.Mallangtech.com/api/Url") else{
return
}
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/Json", forHTTPHeaderField: "Content-Type")
let body:[String: AnyHashable] = [
"status": 200,
"shortlink":"okko"]
request.httpBody = try? JSONSerialization.data(withJSONObject: body, options: .fragmentsAllowed)
//hiting api
let task = URLSession.shared.dataTask(with: request) { data, _, Error in
guard let data = data, Error == nil else {
return
}
do{
let response = try JSONSerialization.jsonObject(with: data, options: .allowFragments)
print("Success\(response)")
}
catch{
print (error)
}
}
task.resume()
}
```