We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi ,
i'm testing the Library with https://openweathermap.org
the API link is "http://api.openweathermap.org/data/2.5/weather"
my model is
struct weather:Codable { let q : String let appid : String let mode : String }
and the request is
var request = URLRequest(url: URL(string: "http://api.openweathermap.org/data/2.5/weather")!) request.httpMethod = "POST" let post2 = weather(q: "london", appid: "f4be702b940e5073d765cb2473f0b31b", mode: "xml") do{ let body = try XMLEncoder().encode(post2, withRootKey: "current") request.httpBody = body } catch{} let session = URLSession.shared let task = session.dataTask(with: request) { data, response, error in if error != nil { print("error: \(String(describing: error))")// Handle error… return } guard let data = data else {return } print("response: \(response)") print("data: \(data)") } task.resume()
I don't know where is the problem ! I always get error code 401
but on PostMan it working fine
The text was updated successfully, but these errors were encountered:
Error code 401 is coming from the web API, not this framework: https://httpstatuses.com/401
Sorry, something went wrong.
my request was wrong I was send it in body
but it should be on parameter with url link
https://stackoverflow.com/questions/54177119/get-error-401-when-post-request-using-xmlparsing-swift-library
No branches or pull requests
Hi ,
i'm testing the Library with https://openweathermap.org
the API link is
"http://api.openweathermap.org/data/2.5/weather"
my model is
and the request is
I don't know where is the problem !
I always get error code 401
but on PostMan it working fine
The text was updated successfully, but these errors were encountered: