Issue
This Content is from Stack Overflow. Question asked by Mason Ballowe
I am attempting to query the Marvel API: https://developer.marvel.com/docs
When I try to select the first public option to get /v1/public/characters it provides me with the URL to query:
https://gateway.marvel.com:443/v1/public/characters?apikey=MYKEY
When I run my normal Rest API code with this URL, I get no response. See below:
let urlString = "https://gateway.marvel.com:443/v1/public/characters?apikey=MYKEY"
let url = URL(string: urlString)
let session = URLSession.shared
let dataTask = session.dataTask(with: url!) { (data, response, error) in
guard let data = data else {return}
do {
let recievedData = try JSONDecoder().decode([ReturnedData].self, from: data)
} catch {
print("Error")
}
}
dataTask.resume()
I already followed instructions from :Error 401 Unauthorized connecting with Marvel API and added an “*” as a new option for authorized domains. I do not know what the “hash” is as I’m using the exact copy/paste of the API URL recommended by Marvel.
Any help?
Solution
As @marcel-konjata noted, I changed my authorized referrers in my My Developer Account
page. And it worked.
This Question was asked in StackOverflow by Claudio Wolszczak and Answered by shahwan42 It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.