创建文件配置项并返回详细信息

最近更新时间: 2026-10-11 00:12:05

1. 接口描述

接口请求域名: tsf.api3.fincloud.tencent.com。

创建文件配置项,返回详细信息

默认接口请求频率限制:20次/秒。

接口更新时间:2025-08-06 23:23:55。

接口只验签名不鉴权。

2. 输入参数

以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见公共请求参数。

参数名称 必选 允许NULL 类型 描述
Action 是 否 String 公共参数,本接口取值:CreateFileConfigWithDetailResp
Version 是 否 String 公共参数,本接口取值:2018-03-26
Region 是 否 String 公共参数,地域信息可通过DescribeRegions接口查看产品支持的地域列表
ConfigFileName 是 是 String 配置项文件名
示例值:
ApplicationId 是 是 String 配置项关联应用ID
示例值:
ConfigVersionDesc 否 是 String 配置项版本描述
示例值:
ConfigFileCode 否 是 String 配置项文件编码,utf-8 或 gbk。注:如果选择 gbk,需要新版本 tsf-consul-template (公有云虚拟机需要使用 1.32 tsf-agent,容器需要从文档中获取最新的 tsf-consul-template-docker.tar.gz)的支持
示例值:
EncodeWithBase64 否 是 Bool Base64编码的配置项
示例值:
ProgramIdList 否 是 Array of String 无
示例值:
ConfigName 是 是 String 配置项名称
示例值:
ConfigVersion 是 是 String 配置项版本
示例值:
ConfigFileValue 是 是 String 配置项文件内容(原始内容编码需要 utf-8 格式,如果 ConfigFileCode 为 gbk,后台会进行转换)
示例值:
ConfigFilePath 是 是 String 发布路径
示例值:
ConfigPostCmd 否 是 String 后置命令
示例值:

3. 输出参数

参数名称 类型 描述
Result FileConfig 文件配置项
示例值:查看
RequestId String 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。

4. 错误码

以下仅列出了接口业务逻辑相关的错误码,其他错误码详见公共错误码。

错误码 描述
InvalidParameterValue.ConfigExists 配置项已存在。
FailedOperation.ConfigCreateFailed 配置项创建失败。
InvalidParameterValue.ApplicationNotExists 无法获取应用。
InvalidParameterValue.FileConfigExists 文件配置项已存在。
InvalidParameterValue.FileConfigFileNameInvalid 文件配置项文件名称不合规。
InvalidParameterValue.FileConfigFilePathInvalid 文件配置项文件路径不合规。
InvalidParameterValue.FileConfigNameInvalid 文件配置项名称不合规。
InvalidParameterValue.ResourcePermissionDenied 无权限操作资源%s。
InvalidParameterValue.FileConfigVersionInvalid 文件配置项版本不合规。
InvalidParameterValue.FileConfigVersionDescInvalid 文件配置项版本描述不合规。
MissingParameter.FileConfigFileValueRequired 文件配置项文件内容未填写。
InvalidParameterValue.FileConfigExistsPath 配置文件路径重复。
InvalidParameterValue.FileConfigExistsPathOther 其他用户已发布此配置文件路径。

5. 示例

示例1 创建文件配置项

为应用创建文件配置

输入示例

POST / HTTP/1.1
Host: tsf.api3.fincloud.tencent.com
Content-Type: application/json
X-TC-Action: CreateFileConfigWithDetailResp
<Common Parameters>

{
  "ConfigName": "app_config",
  "ConfigVersion": "v1.0",
  "ConfigFileName": "config.txt",
  "ConfigFileValue": "config=enabled",
  "ApplicationId": "application-yx8m24ga",
  "ConfigFilePath": "/root/app"
}

输出示例

{
  "Response": {
    "RequestId": "a7d2e82d-0bf1-4e44-b296-ccf60bcdbb3c",
    "Result": {
      "ApplicationId": "application-yx8m24ga",
      "ApplicationName": null,
      "ConfigFileCode": "UTF-8",
      "ConfigFileName": "config.txt",
      "ConfigFilePath": "/root/app",
      "ConfigFileValue": "config=enabled",
      "ConfigFileValueLength": 14,
      "ConfigId": "dcfg-f-yq75blda",
      "ConfigName": "app_config",
      "ConfigPostCmd": "",
      "ConfigVersion": "v1.0",
      "ConfigVersionCount": null,
      "ConfigVersionDesc": null,
      "CreationTime": null,
      "DeleteFlag": null,
      "LastUpdateTime": null
    }
  }
}