gpt4 book ai didi

json - 获取请求状态代码 : 400 Swift

转载 作者:行者123 更新时间:2023-11-30 12:32:26 26 4
gpt4 key购买 nike

我收到代码错误**状态代码:400*

URL: https://conversation.8villages.com/1.0/contents/articles?state=published } 
{ status code: 400, headers {
Connection = "keep-alive";
"Content-Length" = 2;
"Content-Type" = "application/json";
Date = "Tue, 11 Apr 2017 07:49:13 GMT";
Server = nginx;

} }
2 bytes
SUCCESS
JSON: {

}

我的 json 结果成功,但为什么不显示我的数据?

实际上我得到了带有消费者 key 、消费者 secret 、 token key 和 token secret 的请求方法Alamofire。像这样:

    let params: HTTPHeaders = ["oauth_consumer_key":"*****",
"oauth_consumer_secret":"*****",
"oauth_token_key":"*****.",
"oauth_token_secret": "*****",
"oauth_signature_method": "HMAC-SHA1",
"oauth_timestamp_key" : "1491366048",
"oauth_version": "1.0"] as [String : Any] as! HTTPHeaders;

Alamofire.request("https://conversation.8villages.com/1.0/contents/articles?state=published", method: .get, headers: params).responseJSON { response in
print("test", response.request!) // original URL request
print("ini responseny", response.response!) // HTTP URL response
print("test", response.data!) // server data
print("test", response.result) // result of response serialization

if let JSON = response.result.value {
print("JSON: \(JSON)")
}
}

如何获取我的数据API?

最佳答案

请记住:

400 Bad Request : The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).

为了更好地理解,请检查:this

关于json - 获取请求状态代码 : 400 Swift,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43339893/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com