我想动态获取七牛云每个仓库的外链地址,使用接口 /v6/domain/list?tbl=<bucketName>,但是 iOS 端报错如下:
resquest [/v6/domain/list?tbl=test] failed, error = Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: bad request (400)" UserInfo={com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x6000000325a0> { URL: http://rsf.qbox.me/v6/domain/... } { status code: 400, headers {
"Cache-Control" = "no-store";
Connection = "keep-alive";
"Content-Length" = 26;
"Content-Type" = "application/json";
Date = "Thu, 31 Aug 2017 14:57:10 GMT";
Server = nginx;
"X-Log" = "RS/400";
"X-Reqid" = "nzACAB-Ozfci9t8U";
} }, NSErrorFailingURLKey=http://rsf.qbox.me/v6/domain/... com.alamofire.serialization.response.error.data=<7b226572 726f7222 3a224261 64206d65 74686f64 3a207636 227d>, NSLocalizedDescription=Request failed: bad request (400)}
response = {
error = "Bad method: v6";
}
有个疑问:api 文档里面都只有后面的 url 路径(比如我请求的完整地址为:http://xxx.me/list?tbl=xxx,文档里面都只有list?tbl=xxx,没有指明前面的基础路径 http://xxx.me),这个基础路径哪里能查到?我还是从 python 库的测试代码里面看到的http://rsf.qbox.me,我也试过 api.qiniu.com,但是不正确
另外还有一个问题,比如我用仓test1的外链域名地址去请求仓test2的资源列表,也能请求到,这有问题吧?
https://developer.qiniu.com/k...
里面写了
Host: api.qiniu.com
Host字段一般即是请求地址