查询导出模板列表
按类型列出当前项目下保存的所有导出模板(同步返回)。模板可在项目「配置 → 导出模板」页面创建/编辑,也可以通过本接口的同组 CRUD 接口管理。
模板的 id 通常用于 导出 INI 接口的 template_id 入参 —— 模板里携带的 format / mode / languages / field_order 决定导出行为。
请求地址
GET {BASE_URL}/api/open/v1/export-templates鉴权 Header
和 创建翻译任务 完全一样。GET 无 body 参与签名,签名算式退化为 MD5(timestamp + "" + appSecret)。
请求参数(Query)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
type | string | 是 | 模板类型,见下表 |
type 取值
| 值 | 说明 | 对应页面位置 |
|---|---|---|
project_strings | 项目字符串(全文本)的导出模板 | 配置 → 导出模板 → 「全文本」标签页 |
task_strings | 任务字符串的导出模板 | 配置 → 导出模板 → 「任务」标签页 |
TM / 术语库的导出模板暂不通过开放平台暴露。
响应
json
{
"success": true,
"code": 0,
"msg": "ok",
"trace_id": "...",
"data": {
"type": "project_strings",
"templates": [
{
"id": "tpl-9d3f1a2c",
"name": "默认 INI 导出",
"is_default": true,
"format": "ini",
"mode": "single",
"languages": ["en", "ja", "ko"],
"field_order": [
{ "type": "language", "value": "en" },
{ "type": "language", "value": "ja" },
{ "type": "language", "value": "ko" }
],
"created_at": 1715520000000,
"updated_at": 1715520000000
}
]
}
}字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
type | string | 透传请求里的 type |
templates | array | 该类型下的全部模板(无配置则为空数组) |
templates[].id | string | 模板唯一 ID,可作为 导出 INI 的 template_id |
templates[].name | string | 模板名称 |
templates[].is_default | bool | 是否为该类型下的默认模板(同类型下最多一个为 true) |
templates[].format | string | 导出格式,可选 csv / json / xlsx / ini / xliff / xml |
templates[].mode | string | 单文件 single / 各语言分离 separate(仅在 format 支持时存在) |
templates[].languages | string[] | 模板默认勾选的目标语言代码列表 |
templates[].field_order | array | 字段/语言的顺序列表,type 为 field 或 language |
templates[].created_at | int | 模板创建时间(毫秒时间戳) |
templates[].updated_at | int | 模板更新时间(毫秒时间戳) |
错误码
| code | 说明 |
|---|---|
| 400 | type 缺失或值非法(不在 project_strings / task_strings 中) |
| 401 | 签名校验失败 / 时间戳过期 |
| 403 | App Secret 未配置 |
| 404 | appKey 无效 |
| 500 | 系统错误 |
示例
bash
APP_KEY="5685414646a54423c891d87194d87f3f"
APP_SECRET="<你的 App Secret>"
BASE_URL="https://api.loxily.com"
TIMESTAMP=$(date +%s)
SIGN=$(printf '%s' "${TIMESTAMP}${APP_SECRET}" | md5)
curl -s -G "${BASE_URL}/api/open/v1/export-templates" \
--data-urlencode "type=project_strings" \
-H "X-Loxily-AppKey: ${APP_KEY}" \
-H "X-Loxily-Timestamp: ${TIMESTAMP}" \
-H "X-Loxily-Sign: ${SIGN}"