下载或预览文件
curl --request GET \
--url 'https://api.flashcat.cloud/safari/artifact/stream?app_key='import requests
url = "https://api.flashcat.cloud/safari/artifact/stream?app_key="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.flashcat.cloud/safari/artifact/stream?app_key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flashcat.cloud/safari/artifact/stream?app_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.flashcat.cloud/safari/artifact/stream?app_key="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.flashcat.cloud/safari/artifact/stream?app_key=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/safari/artifact/stream?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body"<string>"{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter skill_id is not valid."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "AccessDenied",
"message": "Access Denied."
}
}<string>{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
}
}产物
下载或预览文件
使用签名令牌下载或预览文件内容。
GET
/
safari
/
artifact
/
stream
下载或预览文件
curl --request GET \
--url 'https://api.flashcat.cloud/safari/artifact/stream?app_key='import requests
url = "https://api.flashcat.cloud/safari/artifact/stream?app_key="
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.flashcat.cloud/safari/artifact/stream?app_key=', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.flashcat.cloud/safari/artifact/stream?app_key=",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.flashcat.cloud/safari/artifact/stream?app_key="
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.flashcat.cloud/safari/artifact/stream?app_key=")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.flashcat.cloud/safari/artifact/stream?app_key=")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body"<string>"{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InvalidParameter",
"message": "The specified parameter skill_id is not valid."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "Unauthorized",
"message": "You are unauthorized."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "AccessDenied",
"message": "Access Denied."
}
}<string>{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "RequestTooFrequently",
"message": "Request too frequently."
}
}{
"request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
"error": {
"code": "InternalError",
"message": "We encountered an internal error, and it has been reported. Please try again later."
}
}限制说明
| 项目 | 说明 |
|---|---|
| 速率限制 | 每个账户 1,000 次/分钟;50 次/秒 |
| 权限要求 | 无 —— 持有有效的 app_key 即可调用 |
使用说明
- 使用
/safari/artifact/sign返回的完整链接,并以签发时同一成员的app_key认证。令牌过期或不属于当前成员时返回ResourceNotFound。 - 存放在对象存储中的文件返回
302,跳转到 5 分钟内有效的预签名 URL,请跟随重定向。download模式下的 CSV 文件,以及存放在 runner 上的文件,直接以200返回内容。 - CSV 文件在
download模式下会补上 UTF-8 BOM(原本没有时)并设置Content-Type: text/csv; charset=utf-8,以便表格软件正确打开。 - 存放在 runner 上的文件,若 runner 已不可用则返回
410和纯文本提示;需重新运行任务生成文件。 - 响应携带
Cache-Control: private, no-store。
授权
在 Flashduty 控制台 我的 → APP Key 中创建的 APP Key。可通过 query 参数 app_key 或请求头 Fd-App-Key 传入。实际可访问范围是该 APP Key 的权限范围与创建者当前角色权限的交集,请妥善保管。
查询参数
由 POST /safari/artifact/sign 签发的令牌。与调用账号及成员绑定,有效期 5 分钟。
download(默认)以附件形式返回文件;preview 以 inline 方式返回供浏览器预览。其他取值按 download 处理。
可用选项:
download, preview 响应
文件内容。存放在 runner 上的文件和 download 模式下的 CSV 文件直接返回内容。Content-Disposition 按 mode 为 attachment 或 inline。
The response is of type file.
此页面对您有帮助吗?