静态导出
获取静态导出作业状态
获取静态导出任务的当前状态。启动任务后,可以轮询此端点,直到 status 变为 completed(或 failed)。
任务完成后,响应中会包含 bundleUrl、sizeBytes 和 expiresAt。bundleUrl 是一个有时限的预签名 S3 链接。请在 expiresAt 时间戳之前下载该软件包。可再次调用此端点获取新的链接,底层的导出文件仍可复用。
静态导出仅适用于 Enterprise 套餐。
使用管理员 API 密钥进行身份验证。
GET
/
static-export
/
{projectId}
/
jobs
/
{jobId}
获取静态导出任务状态
curl --request GET \
--url https://api.mintlify.com/v1/static-export/{projectId}/jobs/{jobId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v1/static-export/{projectId}/jobs/{jobId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mintlify.com/v1/static-export/{projectId}/jobs/{jobId}', 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.mintlify.com/v1/static-export/{projectId}/jobs/{jobId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.mintlify.com/v1/static-export/{projectId}/jobs/{jobId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.mintlify.com/v1/static-export/{projectId}/jobs/{jobId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/static-export/{projectId}/jobs/{jobId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"jobId": "6520f3a1c9b1a20012ab34cd",
"status": "completed",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"error": "<string>",
"bundleUrl": "https://mintlify-static-exports.s3.amazonaws.com/6520f3a1c9b1a20012ab34cd/export.zip?X-Amz-Signature=...",
"sizeBytes": 18432000,
"expiresAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}此端点处于私有 Beta 阶段,需要企业协议。请联系 sales@mintlify.com 申请访问权限。
授权
路径参数
由 Start static export job 返回的静态导出任务的 ID。
响应
导出任务的当前状态。
静态导出任务的唯一标识符。
示例:
"6520f3a1c9b1a20012ab34cd"
任务的当前状态。
可用选项:
queued, running, completed, failed 示例:
"completed"
任务的创建时间。
任务上次状态变更的时间。
人类可读的错误消息。仅当 status 为 failed 时才会出现,否则为 null。
指向静态导出软件包归档的有时限预签名 S3 链接。仅当 status 为 completed 时才会出现。请在 expiresAt 之前下载该软件包。可再次调用此端点获取新的链接。
示例:
"https://mintlify-static-exports.s3.amazonaws.com/6520f3a1c9b1a20012ab34cd/export.zip?X-Amz-Signature=..."
软件包大小(字节)。仅当 status 为 completed 时才会出现。
示例:
18432000
当前 bundleUrl 的过期时间。仅当 status 为 completed 时才会出现。
⌘I
获取静态导出任务状态
curl --request GET \
--url https://api.mintlify.com/v1/static-export/{projectId}/jobs/{jobId} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v1/static-export/{projectId}/jobs/{jobId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mintlify.com/v1/static-export/{projectId}/jobs/{jobId}', 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.mintlify.com/v1/static-export/{projectId}/jobs/{jobId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.mintlify.com/v1/static-export/{projectId}/jobs/{jobId}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.mintlify.com/v1/static-export/{projectId}/jobs/{jobId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/static-export/{projectId}/jobs/{jobId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"jobId": "6520f3a1c9b1a20012ab34cd",
"status": "completed",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"error": "<string>",
"bundleUrl": "https://mintlify-static-exports.s3.amazonaws.com/6520f3a1c9b1a20012ab34cd/export.zip?X-Amz-Signature=...",
"sizeBytes": 18432000,
"expiresAt": "2023-11-07T05:31:56Z"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}