Bucket接口 > 获取 Bucket 空间域名 | ||||||||||
描述本接口用于获取 Bucket 的域名列表。 请求请求地址:
GET /v6/domain/list?tbl=<bucketName> HTTP/1.1 Host: api.qiniu.com Content-Type: application/x-www-form-urlencoded Authorization: QBox <AccessToken>
该请求操作的实现使用了所有操作的公共请求头。
该请求操作的请求体为空 响应
该操作的实现不会返回特殊错误。 请求示例: GET /v6/domain/list?tbl=test01 HTTP/1.1 Host: api.qiniu.com User-Agent: Go-http-client/1.1 Authorization: Qiniu j853F3bLkWl59I5BOkWm6q1Z1mZClpr9Z9CLfDE0:jfblnkj6JsrlxgbE3l4SfhSyiL4= Accept-Encoding: gzip 响应示例: HTTP/1.1 200 OK Connection: keep-alive Content-Type: application/json Date: Thu, 17 Aug 2017 03:45:21 GMT Server: nginx Vary: Accept-Encoding X-Reqid: BksAALTAQtVZhdsU [ "test.bkt.clouddn.com", "test.qiniudemo.com" ] 示例function bucketDomain($accessKey, $secretKey, $bucketName) { $authObj = new Auth($accessKey, $secretKey); $url = "http://api.qiniu.com/v6/domain/list?tbl={$bucketName}"; $headers = $authObj->getHeaders($url, null, 'application/x-www-form-urlencoded'); // 创建一个新cURL资源 $curl = curl_init(); // 设置URL和相应的选项 curl_setopt($curl, CURLOPT_URL, $url); //CURLOPT_HEADER为true设置头文件的信息作为数据流输出 curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_TIMEOUT, 60); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, strtoupper('GET')); curl_setopt($curl, CURLOPT_POST, true); $result = curl_exec($curl); curl_close($curl); return $result; } $accessKey = 'xxx'; $secretKey = 'xxx'; $bucketName = '123_1';//存储空间名称,要求在互站云对象存储范围内唯一,由3~63个字符组成,支持小写字母、短划线-和数字,且必须以小写字母或数字开头和结尾。 echo createbucket($accessKey, $secretKey, $bucketName); |