跳转到内容

文案

查询或修改项目中的文案

导出文案

GET /teams/{teamName}/projects/{projectName}/keys/export

通过该接口可以批量导出项目中的文案,支持按照标签或语种进行筛选,导出格式支持 json, csv, android-xml, apple-strings 等。

此接口返回导出文件的下载地址,如果是单个语种导出,则直接返回文件的下载地址,如果导出多个语种,则会返回一个压缩包的下载地址。

路径参数

  • Name
    teamName
    Type
    string
    Description

    团队标识,在团队设置页中可以查看

  • Name
    projectName
    Type
    string
    Description

    项目标识,在项目设置页中可以查看

必选参数

  • Name
    tags
    Type
    array[string]
    Description

    按标签导出,如果不传则导出全部

  • Name
    languages
    Type
    array[string]
    Description

    按语言导出,如果不传则导出全部

  • Name
    type
    Type
    string
    Description

    导出格式类型,可选 json, csv, android-xml, apple-strings

Terminal window
curl --request GET \
--url https://api.yundict.com/teams/{teamName}/projects/{projectName}/keys/export?type=json \
--header "X-Api-Token: {token}" \
{
"success": true,
"data": "https://cdn.yundict.com/download.zip"
}

查询文案

GET /teams/{teamName}/projects/{projectName}/keys

路径参数

  • Name
    teamName
    Type
    string
    Description

    团队标识,在团队设置页中可以查看

  • Name
    projectName
    Type
    string
    Description

    项目标识,在项目设置页中可以查看

可选参数

  • Name
    keyword
    Type
    string
    Description

    搜索关键词

  • Name
    page
    Type
    number
    Description

    分页:页码,默认为 1

  • Name
    limit
    Type
    number
    Description

    分页:每页数量,默认为 20

  • Name
    sort
    Type
    string
    Description

    排序方式,可选 asc | desc

Terminal window
curl --request GET \
--url https://api.yundict.com/teams/{teamName}/projects/{projectName}/keys \
--header "X-Api-Token: {token}" \
{
"data": [
{
"name": "home_title",
"translation": {
"en-US": "Home",
"zh-CN": "首页"
}
}
...
]
}

创建文案

POST /teams/{teamName}/projects/{projectName}/keys

路径参数

  • Name
    teamName
    Type
    string
    Description

    团队标识,在团队设置页中可以查看

  • Name
    projectName
    Type
    string
    Description

    项目标识,在项目设置页中可以查看

必选参数

  • Name
    name
    Type
    string
    Description

    文案标识名称

  • Name
    tags
    Type
    array
    Description

    标签列表

  • Name
    translations
    Type
    array
    Description

    翻译内容列表

Terminal window
curl --request POST \
--url https://api.yundict.com/teams/{teamName}/projects/{projectName}/keys \
--header "X-Api-Token: {token}" \
--header 'Content-Type: application/json' \
--data '
{
"name": "home_title"
"tags": [ "app" ],
"translations": [
{
"languageISO": "en-US",
"content": "首页"
}
]
}
'
{
"success": true
}

修改文案

PATCH /teams/{teamName}/projects/{projectName}/keys/{keyName}

路径参数

  • Name
    teamName
    Type
    string
    Description

    团队标识,在团队设置页中可以查看

  • Name
    projectName
    Type
    string
    Description

    项目标识,在项目设置页中可以查看

  • Name
    keyName
    Type
    string
    Description

    文案标识

可选参数

  • Name
    name
    Type
    string
    Description

    文案标识名称

  • Name
    tags
    Type
    array
    Description

    标签列表

  • Name
    translations
    Type
    array
    Description

    翻译内容列表

Terminal window
curl --request PATCH \
--url https://api.yundict.com/teams/{teamName}/projects/{projectName}/keys \
--header "X-Api-Token: {token}" \
--header 'Content-Type: application/json' \
--data '
{
"name": "home_title"
"tags": [ "app" ],
"translations": [
{
"languageISO": "en-US",
"content": "首页"
}
]
}
'
{
"success": true
}

删除文案

DELETE /teams/{teamName}/projects/{projectName}/keys/{keyName}

路径参数

  • Name
    teamName
    Type
    string
    Description

    团队标识,在团队设置页中可以查看

  • Name
    projectName
    Type
    string
    Description

    项目标识,在项目设置页中可以查看

  • Name
    keyName
    Type
    string
    Description

    文案标识

Terminal window
curl --request DELETE \
--url https://api.yundict.com/teams/{teamName}/projects/{projectName}/keys/{keyName} \
--header "X-Api-Token: {token}"
{
"success": true
}