授权地址:
https://auth.sinas3.com/v1.0
请求头:
X-Auth-User access_key
X-Auth-Key secret_key
响应头:
X-Storage-Url 管理地址 https://api.sinas3.com/v1/SAE_appname
X-Auth-Token 管理令牌
返回内容:
空白
应用管理地址:
https://api.sinas3.com/v1/SAE_appname
https://api.sinas3.com/v1/SAE_appname?limit=限制数&prefix=前缀&format=json|xml
请求头:
X-Auth-Token 管理令牌
响应头:
X-Account-Bytes-Used 总占用
X-Account-Container-Count 总域名数
X-Account-Object-Count 总文件数
返回内容:
域名列表
域名管理地址
https://api.sinas3.com/v1/SAE_appname/domain
https://api.sinas3.com/v1/SAE_appname/domain?limit=限制数&marker=偏移量&prefix=前缀&path=目录&format=json|xml
请求头:
X-Auth-Token 管理令牌
X-Container-Read private 是否私有Domain,'.r:*' '0' 表示是否允许读取,防盗链设置也在此
X-Container-Meta-Web-Listings 是否允许展示域名中的文件列表,'true' 'false' 表示开启关闭
X-Container-Meta-Expires-Rule
X-Container-Meta-Web-Error 404Redirect: 404跳转页面,只能是本应用页面,或本应用Storage中文件。例如http://appname.sinaapp.com/404.html或http://appname-domain.stor.sinaapp.com/404.png
X-Container-Meta-Tags 域名简介,json格式:json_encode(array('tag1', 'tag2'));
X-Container-Meta-Quota quotaLevel 配额 意义不明 参数不明
响应头:
X-Container-Object-Count 域名总文件书
X-Container-Bytes-Used 域名总占用数
返回内容:
文件列表
详细设置:
expires 浏览器缓存超时,缓存过期设置,功能与Apache的Expires配置相同
$expires = 'ExpiresActive On
ExpiresDefault "access plus 30 days"
ExpiresByType text/html "access plus 1 month 15 days 2 hours"
ExpiresByType image/gif "modification plus 5 hours 3 minutes"
ExpiresByType image/jpg A2592000
ExpiresByType text/plain M604800
if ( $v['active'] == 1 && ( isset($v['byType']) || isset($v['default']) ) ) $headers['X-Container-Meta-Expires-Rule'] = json_encode($v);
allowReferer 防盗链设置,根据Referer防盗链
$allowReferer = array();
$allowReferer['hosts'][] = '*.elmerzhang.com'; // 允许访问的来源域名,千万不要带 http://。支持通配符*和?
$allowReferer['hosts'][] = 'elmer.sinaapp.com';
$allowReferer['hosts'][] = '?.elmer.sinaapp.com';
$allowReferer['redirect'] = 'http://elmer.sinaapp.com/'; // 盗链时跳转到的地址,仅允许跳转到本APP的页面,且不可使用独立域名。如果不设置或者设置错误,则直接拒绝访问。
//$allowReferer = false; // 如果要关闭一个Domain的防盗链功能,直接将allowReferer设置为false即可
if ( !empty( $allowReferer['hosts'] ) ) {
$rules = array();
foreach( $allowReferer['hosts'] as $host ) {
if ( $host ) $rules[] = '.r:' . $host;
}
if ( $allowReferer['redirect'] ) {
$rules[] = '.rd:' . $allowReferer['redirect'];
}
$headers['X-Container-Read'] = join(',', $rules);
}
文件管理地址
https://api.sinas3.com/v1/SAE_appname/domain/filename
请求头:
X-Auth-Token 管理令牌
X-Object-Meta-Private 设置文件为私有,则文件不可被下载,'1' '0' 表示开启关闭
X-Object-Meta-Expires-Rule 浏览器缓存超时,功能与Apache的Expires配置相同
Content-Type
Content-Encoding
Content-Disposition
ETag
响应头:
文件属性
返回内容:
文件内容
文件操作:
上传文件 PUT
删除文件 DELETE