- Development Integration
- /
- SDK
- /
- Java
- /
Management module
- /
Manage data resources and permissions
- /
- Batch create data resource extension fields
¶ Create data resource extension fields
Update time: 2025-07-23 07:34:21
Currently only supports tree type data resources
¶ Method Name
ManagementClient.batchCreateDnef
¶ Request Parameters
Type: BatchCreateDenfDto
| Name | Type | Is it required | Default Value | Description | Example Value |
|---|---|---|---|---|---|
| namespaceCode | string | Yes | Permission space code | examplePermissionNamespace | |
| resourceCode | string | Yes | Data resource code | treeResourceCode | |
| key | string | Yes | Extension field Key | str | |
| fieldList | Dnef[] | Yes | Extended field list |
¶ Sample Code
package test.management.dataPermission.resource;
import cn.authing.sdk.java.client.ManagementClient;
import cn.authing.sdk.java.dto.BatchCreateDenfDto;
import cn.authing.sdk.java.dto.Dnef;
import cn.authing.sdk.java.dto.Dnef.ValueType;
import cn.authing.sdk.java.dto.DnefConfig;
import cn.authing.sdk.java.dto.IsSuccessRespDto;
import cn.authing.sdk.java.model.ManagementClientOptions;
import cn.authing.sdk.java.util.JsonUtils;
import cn.hutool.core.collection.ListUtil;
public class BatchCreateDnefTest {
// Need to be replaced with your GenAuth Access Key ID
private static final String ACCESS_KEY_ID = "AUTHING_ACCESS_KEY_ID";
// Need to be replaced with your GenAuth Access Key Secret
private static final String ACCESS_KEY_SECRET = "AUTHING_ACCESS_KEY_SECRET";
public static void main(String[] args) throws Throwable {
ManagementClientOptions clientOptions = new ManagementClientOptions();
clientOptions.setAccessKeyId(ACCESS_KEY_ID);
clientOptions.setAccessKeySecret(ACCESS_KEY_SECRET);
// If you are a private deployment customer, you need to set the GenAuth service domain name
// clientOptions.setHost("https://api.your-authing-service.com");
ManagementClient client = new ManagementClient(clientOptions);
BatchCreateDenfDto createDenfDto = new BatchCreateDenfDto();
createDenfDto.setResourceCode("treeResourceCode");
createDenfDto.setNamespaceCode("examplePermissionNamespace");
Dnef dnef1 = new Dnef();
dnef1.setKey("select");
dnef1.setValueType(ValueType.SELECT);
dnef1.setDescription("select");
dnef1.setLabel("select");
dnef1.setConfig(new DnefConfig(ListUtil.of(new DnefConfig.Option("str_value"))));
Dnef dnef2 = new Dnef();
dnef2.setKey("str");
dnef2.setValueType(ValueType.STRING);
dnef2.setDescription("str");
dnef2.setLabel("str");
createDenfDto.setFieldList( ListUtil.of(dnef1, dnef2));
IsSuccessRespDto res = client.batchCreateDnef(createDenfDto);
System.out.println(JsonUtils.serialize(res));
}
}
¶ Request Response
Type: IsSuccessRespDto
| Name | Type | Description |
|---|---|---|
| statusCode | number | Business status code. You can use this status code to determine whether the operation is successful. 200 means success. |
| message | string | Description |
| apiCode | number | Segment error code, through which the specific error type can be obtained (not returned for successful requests). For a detailed list of error codes, see:API Code List (opens new window) |
| requestId | string | Request ID. Returned when the request fails. |
| data | IsSuccessDto | Whether the operation is successful |
¶ Data Structure
¶ IsSuccessDto
| Name | Type | Is it required | Description | Example Value |
|---|---|---|---|---|
| success | boolean | yes | Whether the operation is successful | true |
¶ Dnef
| Name | Type | Is it required | Description | Example Value |
|---|---|---|---|---|
| key | string | Yes | Extended field Key | str |
| valueType | ValueType | Yes | Extended field value type | STRING (text), SELECT (single choice) |
| label | string | Yes | Extended field display Name | str_label |
| config | DnefConfig | No | Field configuration, single choice type field must be passed |
¶ DnefConfig
| Name | Type | Is it required | Description | Example Value |
|---|---|---|---|---|
| options | Option[] | Yes | Single-select type field option list |
¶ Option
| Name | Type | Is it required | Description | Example Value |
|---|---|---|---|---|
| value | string | Yes | Option value | option1 |
