Register Resource¶
注册资源。一次最多可注册 1000 个资源。
请求格式¶
POST https://{apigw-address}/app-portal-service/v2.3/resource/create
请求参数(URI)¶
| 名称 | 位置(Path/Query) | 必需/可选 | 数据类型 | 描述 | 
|---|---|---|---|---|
| orgId | Query | 必需 | String | OU ID。如何获取 orgId 信息 >> | 
请求参数(Body)¶
| 名称 | 必需/可选 | 数据类型 | 描述 | 
|---|---|---|---|
| resources | 必需 | Resources 结构体 | 待注册的资源列表。一次最多可注册 1000 个资源。Resources 请求结构体 >> | 
| type | 必需 | String | 资源类型标识符。 | 
| assignCodeTold | 可选 | Boolean | 资源标识符是否和资源代码保持一致。支持以下赋值: 
 默认值为  | 
Resources 请求结构体 
| 名称 | 数据类型 | 描述 | 
|---|---|---|
| code | String | 资源代码。 | 
| name | Object | 资源名称,支持国际化。国际化名称结构体 >> | 
响应参数¶
| 名称 | 数据类型 | 描述 | 
|---|---|---|
| success | Boolean | 资源是否注册成功。 | 
| resources | Resources 结构体 | 资源信息。Resources 返回结构体 >> | 
Resources 返回结构体 
| 名称 | 数据类型 | 描述 | 
|---|---|---|
| id | String | 资源标识符。 | 
| code | String | 资源代码。 | 
| name | Object | 资源的多语言名称。 | 
| type | String | 资源类型。 | 
错误码¶
| 代码 | 描述 | 
|---|---|
| 31400 | 缺少必要参数,或资源名称不符合规则。 | 
| 31404 | 本 OU 未获取此应用。 | 
| 31408 | 资源代码或资源标识符已存在。 | 
| 31415 | 资源总数已达上限。 | 
示例¶
请求示例¶
url: /app-portal-service/v2.3/resource/create?orgId=your_org_ID
method: POST
{
  "type": "your_resource_type",
  "assignCodeToId": true,
  "resources": [
    {
      "code": "your_resource_code_1",
      "name": {
        "defaultValue": "your_resource_name_1",
        "i18nValue": {
          "zh_CN": "your_resource_name_zh_1",
          "en_US": "your_resource_name_en_1"
        }
      }
    },
    {
      "code": "your_resource_code_2",
      "name": {
        "defaultValue": "your_resource_name_2",
        "i18nValue": {
          "zh_CN": "your_resource_name_zh_2",
          "en_US": "your_resource_name_en_2"
        }
      }
    }
  ]
}
返回示例¶
{
  "code": 0,
  "message": "OK",
  "data": {
    "success": true,
    "resources": [
      {
        "id": "your_resource_id_1",
        "code": "your_resource_code_1",
        "type": "your_resource_type_1",
        "name": {
          "defaultValue": "your_resource_name_1",
          "i18nValue": {
            "zh_CN": "your_resource_name_zh_1",
            "en_US": "your_resource_name_en_1"
          }
        }
      },
      {
        "id": "your_resource_id_2",
        "code": "your_resource_code_2",
        "type": "your_resource_type_2",
        "name": {
          "defaultValue": "your_resource_name_2",
          "i18nValue": {
            "zh_CN": "your_resource_name_zh_2",
            "en_US": "your_resource_name_en_2"
          }
        }
      }
    ]
  }
}