静态导出
启动静态导出作业
为部署启动一个静态导出任务。该任务会将你的文档预渲染为一组自包含的静态 HTML、RSC 及资源文件,然后将结果打包为单个可下载的归档文件。
每个部署同一时间只能有一个处于活动状态的静态导出任务。当已有任务处于 queued 或 running 状态时启动新任务,将返回 409。速率限制为每个组织每小时最多启动 10 个任务。
静态导出仅适用于 Enterprise 套餐。
使用管理员 API 密钥进行身份验证。
POST
/
static-export
/
{projectId}
/
jobs
启动静态导出任务
curl --request POST \
--url https://api.mintlify.com/v1/static-export/{projectId}/jobs \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v1/static-export/{projectId}/jobs"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mintlify.com/v1/static-export/{projectId}/jobs', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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"
req, _ := http.NewRequest("POST", 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.post("https://api.mintlify.com/v1/static-export/{projectId}/jobs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/static-export/{projectId}/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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>"
}{
"error": "<string>"
}此端点处于私有 Beta 阶段,需要企业协议。请联系 sales@mintlify.com 申请访问权限。
授权
响应
导出任务已被接受并加入队列。
静态导出任务的唯一标识符。
示例:
"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 POST \
--url https://api.mintlify.com/v1/static-export/{projectId}/jobs \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.mintlify.com/v1/static-export/{projectId}/jobs"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.mintlify.com/v1/static-export/{projectId}/jobs', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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"
req, _ := http.NewRequest("POST", 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.post("https://api.mintlify.com/v1/static-export/{projectId}/jobs")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.mintlify.com/v1/static-export/{projectId}/jobs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.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>"
}{
"error": "<string>"
}