[英]Alamofire request with Header?
I'm trying to make a call to an API that now requires a Client ID as a header. 我正在尝试调用一个API,该API现在需要将Client ID作为标头。
I don't know if I'm anywhere close here but this is what I attempted: 我不知道我是否在附近,但这是我尝试的方法:
let clientID = "theclientIDIGotFromtheWebsite"
let urlString = "https://api.twitch.tv/kraken/channels/"
let headers: HTTPHeaders = [
"ClientID": clientID
]
Alamofire.request(urlString, headers: headers).responseJSON { response in
debugPrint(response)
}
}
I get back an error : message = "No client id specified"; 我得到一个错误:message =“未指定客户端ID”;
The same as if you click the link: https://api.twitch.tv/kraken/channels/ 就像单击链接一样: https : //api.twitch.tv/kraken/channels/
The mini-guide I followed to get the clientID is this: https://blog.twitch.tv/client-id-required-for-kraken-api-calls-afbb8e95f843#.27gij8pj9 我遵循的获取clientID的迷你指南是这样的: https ://blog.twitch.tv/client-id-required-for-kraken-api-calls-afbb8e95f843#.27gij8pj9
The clientID I've put in is 100% correct, I've checked a few times. 我输入的clientID是100%正确的,我已经检查了几次。
Any ideas here? 这里有什么想法吗?
“迷你指南”使用键"Client-ID"
代替"Client-ID"
"ClientID"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.