查询字段列表 - ListDataclassFields
功能介绍
查询字段列表
调用方法
请参见如何调用API。
授权信息
账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限,具体权限要求请参见权限和授权项。
URI
GET /v1/{project_id}/workspaces/{workspace_id}/soc/dataclasses/{dataclass_id}/fields
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| project_id | 是 | String | 参数解释: 项目ID,用于明确项目归属,配置后可通过该ID查询项目下资产,可以通过调用API获取,也可以从控制台获取。获取项目ID 约束限制: 不涉及 取值范围: 不涉及 默认取值: 不涉及 |
| workspace_id | 是 | String | 参数解释: 工作空间ID,用于指定操作的工作空间范围。 约束限制: 不涉及 取值范围: 不涉及 默认取值: 不涉及 获取方式: 可通过调用查询数据类列表接口获取,也可从控制台获取。 |
| dataclass_id | 是 | String | 参数解释: 数据类id 约束限制: 不涉及 取值范围: 不涉及 默认取值: 不涉及 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| offset | 否 | Integer | 参数解释: 偏移量 约束限制: 不涉及 取值范围: 不涉及 默认取值: 不涉及 |
| limit | 否 | Integer | 参数解释: 数据量 约束限制: 不涉及 取值范围: 不涉及 默认取值: 不涉及 |
| name | 否 | String | 名称查询 |
| is_built_in | 否 | Boolean | 参数解释: 是否内置 约束限制: 不涉及 取值范围: 不涉及 默认取值: 不涉及 |
| field_category | 否 | String | 字段分类 |
| mapping | 否 | Boolean | 是否展示在分类映射外的其他地方 |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| X-Auth-Token | 是 | String | 参数解释: 用户Token,通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。获取用户Token 约束限制: 不涉及 取值范围: 不涉及 默认取值: 不涉及 |
| content-type | 是 | String | 参数解释: 请求体的内容类型,用于指定请求体的媒体类型 约束限制: 不涉及 取值范围: 默认取值: 不涉及 |
响应参数
状态码:200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| X-request-id | String | 请求ID,格式为:request_uuid-timestamp-hostname |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| field_details | Array of FieldResponseBody objects | 字段列表详情 |
| total | Number | 数据总量 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| id | String | 参数解释: 字段ID 取值范围: 不涉及 |
| cloud_pack_version | String | 参数解释: 订阅包版本 取值范围: 不涉及 |
| business_id | String | 参数解释: 关联业务id 取值范围: 不涉及 |
| business_type | String | 参数解释: 关联业务 取值范围: 不涉及 |
| dataclass_name | String | 参数解释: 数据类名称 取值范围: 不涉及 |
| business_code | String | 参数解释: 业务编码 取值范围: 不涉及 |
| field_key | String | 参数解释: 字段键 取值范围: 不涉及 |
| name | String | 参数解释: 字段名称 取值范围: 不涉及 |
| description | String | 参数解释: 字段描述 取值范围: 不涉及 |
| default_value | String | 参数解释: 默认值 取值范围: 不涉及 |
| display_type | String | 参数解释: 显示类型 取值范围: 不涉及 |
| field_type | String | 参数解释: 字段类型 取值范围: |
| extra_json | String | 参数解释: 附加json 取值范围: 不涉及 |
| field_tooltip | String | 参数解释: 工具提示 取值范围: 不涉及 |
| iu_type | String | 参数解释: 输入输出类型 取值范围: 不涉及 |
| used_by | String | 参数解释: 使用业务 取值范围: 不涉及 |
| json_schema | String | 参数解释: json模式 取值范围: 不涉及 |
| is_built_in | Boolean | 参数解释: 是否内置,true内置,false非内置 取值范围: |
| case_sensitive | Boolean | 参数解释: 大小写敏感,true敏感,false不敏感 取值范围: |
| read_only | Boolean | 参数解释: 只读模式,true只读,false非只读 取值范围: |
| required | Boolean | 参数解释: 是否必填,true必填,false非必填 取值范围: |
| searchable | Boolean | 参数解释: 是否可搜索,true可搜索,false不可搜索 取值范围: |
| visible | Boolean | 参数解释: 是否可见 取值范围: |
| maintainable | Boolean | 参数解释: 是否可维护 取值范围: |
| editable | Boolean | 参数解释: 是否可编辑 取值范围: |
| creatable | Boolean | 参数解释: 是否可创建,true可创建,false不可创建 取值范围: |
| mapping | Boolean | 参数解释: 是否展示在分类映射外的其他地方 取值范围: |
| target_api | String | 参数解释: 目标api 取值范围: 不涉及 |
| creator_id | String | 参数解释: 创建人id 取值范围: 不涉及 |
| creator_name | String | 参数解释: 创建人名称 取值范围: 不涉及 |
| modifier_id | String | 参数解释: 修改人id 取值范围: 不涉及 |
| modifier_name | String | 参数解释: 修改人名称 取值范围: 不涉及 |
| create_time | String | 参数解释: 创建时间,格式为yyyy-MM-ddTHH:mm:ssZ+0800 取值范围: 不涉及 |
| update_time | String | 参数解释: 修改时间,格式为yyyy-MM-ddTHH:mm:ssZ+0800 取值范围: 不涉及 |
状态码:400
| 参数 | 参数类型 | 描述 |
|---|---|---|
| X-request-id | String | 请求ID,格式为:request_uuid-timestamp-hostname |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| code | String | 参数解释: 错误码 取值范围: 不涉及 |
| message | String | 参数解释: 错误描述 取值范围: 不涉及 |
请求示例
查询字段列表,偏移量为10,查询3条
{
"limit" : 3,
"offset" : 10
} 响应示例
状态码:200
{
"total" : 41,
"field_details" : [ {
"business_code" : "Whitelist",
"cloud_pack_version" : "v1",
"create_time" : "2025-04-09T14:39:19Z+0800",
"creator_id" : "system",
"creator_name" : "system",
"default_value" : "value",
"description" : "白名单应用的数据类ID",
"display_type" : "text",
"field_key" : "dataclass_id",
"field_type" : "String",
"id" : "3e94505d-478f-4619-bef9-2c60a9fe3401",
"is_built_in" : true,
"mapping" : true,
"name" : "数据类型ID",
"required" : true,
"update_time" : "2025-04-09T14:39:19Z+0800",
"visible" : true
} ]
} SDK代码示例
SDK代码示例如下。
查询字段列表,偏移量为10,查询3条
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.BasicCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.secmaster.v1.region.SecMasterRegion; import com.huaweicloud.sdk.secmaster.v1.*; import com.huaweicloud.sdk.secmaster.v1.model.*; public class ListDataclassFieldsSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); String projectId = "{project_id}"; ICredential auth = new BasicCredentials() .withProjectId(projectId) .withAk(ak) .withSk(sk); SecMasterClient client = SecMasterClient.newBuilder() .withCredential(auth) .withRegion(SecMasterRegion.valueOf("<YOUR REGION>")) .build(); ListDataclassFieldsRequest request = new ListDataclassFieldsRequest(); request.withWorkspaceId("{workspace_id}"); request.withDataclassId("{dataclass_id}"); try { ListDataclassFieldsResponse response = client.listDataclassFields(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
查询字段列表,偏移量为10,查询3条
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | # coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import BasicCredentials from huaweicloudsdksecmaster.v1.region.secmaster_region import SecMasterRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdksecmaster.v1 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] projectId = "{project_id}" credentials = BasicCredentials(ak, sk, projectId) client = SecMasterClient.new_builder() \ .with_credentials(credentials) \ .with_region(SecMasterRegion.value_of("<YOUR REGION>")) \ .build() try: request = ListDataclassFieldsRequest() request.workspace_id = "{workspace_id}" request.dataclass_id = "{dataclass_id}" response = client.list_dataclass_fields(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
查询字段列表,偏移量为10,查询3条
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic" secmaster "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/secmaster/v1/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") projectId := "{project_id}" auth, err := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). WithProjectId(projectId). SafeBuild() if err != nil { fmt.Println(err) return } hcClient, err := secmaster.SecMasterClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). SafeBuild() if err != nil { fmt.Println(err) return } client := secmaster.NewSecMasterClient(hcClient) request := &model.ListDataclassFieldsRequest{} request.WorkspaceId = "{workspace_id}" request.DataclassId = "{dataclass_id}" response, err := client.ListDataclassFields(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
| 状态码 | 描述 |
|---|---|
| 200 | 请求成功 |
| 400 | 查询数据类列表错误返回body体 |
错误码
请参见错误码。