Updated on 2025-05-09 GMT+08:00

Modifying or Deleting a Data Warehouse Layer

Function

This API is used to modify or delete a data warehouse layer.

Calling Method

For details, see Calling APIs.

URI

PUT /v1/{project_id}/design/data-layers

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Project ID and Account ID.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

IAM token, which is obtained by calling the IAM API for obtaining a user token (value of X-Subject-Token in the response header).

This field is mandatory for authentication using tokens.

workspace

Yes

String

Workspace ID. For details about how to obtain the workspace ID, see Instance ID and Workspace ID.

X-Project-Id

No

String

Project ID. For details about how to obtain the project ID, see Project ID and Account ID.

This parameter is mandatory for API requests that use AK/SK authentication in multi-project scenarios.

Content-Type

No

String

Default value: application/json;charset=UTF-8

This parameter is optional. If the body is available, this parameter is mandatory. If the body is unavailable, you do not need to set this parameter or verify it.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

levels

No

Array of DataLayerVO objects

Request parameters for data warehouse planning.

Table 4 DataLayerVO

Parameter

Mandatory

Type

Description

id

No

String

Data warehouse layer ID, which is a string

level

Yes

Integer

Level, starting from 1

name

Yes

String

Name

type

Yes

String

Data warehouse layer type, which can be ER, DIMENSION, or DM

description

No

String

Data warehouse layer description

is_default

No

Boolean

Whether the layer is the default layer that cannot be deleted, which can be SDI, DWR, or DM

disabled_customized_field_ids

No

Array of strings

IDs of the customized fields disabled at the layer, including table-level and field-level customized fields

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

data

data object

Data returned by the API

Table 6 data

Parameter

Type

Description

value

Array of DataLayerVO objects

Array of data warehouse layers

Table 7 DataLayerVO

Parameter

Type

Description

id

String

Data warehouse layer ID, which is a string

level

Integer

Level, starting from 1

name

String

Name

type

String

Data warehouse layer type, which can be ER, DIMENSION, or DM

description

String

Data warehouse layer description

is_default

Boolean

Whether the layer is the default layer that cannot be deleted, which can be SDI, DWR, or DM

disabled_customized_field_ids

Array of strings

IDs of the customized fields disabled at the layer, including table-level and field-level customized fields

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Error code, for example, DS.6000, indicating that the request fails to be processed.

error_msg

String

Error message

data

Object

Returned data information.

Status code: 401

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code, for example, DS.6000, indicating that the request fails to be processed.

error_msg

String

Error message

data

Object

Returned data information.

Status code: 403

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code, for example, DS.6000, indicating that the request fails to be processed.

error_msg

String

Error message

data

Object

Returned data information.

Status code: 404

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code, for example, DS.6000, indicating that the request fails to be processed.

error_msg

String

Error message

data

Object

Returned data information.

Example Requests

Modify a data warehouse layer based on parameters.

PUT https://{endpoint}/v1/{project_id}/design/data-layers

{
  "levels" : [ {
    "id" : 123456,
    "level" : 1,
    "name" : "SDI",
    "type" : "THIRD_NF",
    "description" : "SDI",
    "is_default" : true,
    "disabled_customized_field_ids" : [ ]
  }, {
    "id" : 123457,
    "level" : 3,
    "name" : "DWR",
    "type" : "DIMENSION",
    "is_default" : true,
    "description" : "DWR",
    "disabled_customized_field_ids" : [ ]
  }, {
    "id" : 123458,
    "level" : 3,
    "name" : "DM",
    "type" : "DM",
    "is_default" : true,
    "description" : "DM",
    "disabled_customized_field_ids" : [ ]
  } ]
}

Example Responses

Status code: 200

The operation succeeds, and the DataLayerVO array is returned.

{
  "data" : {
    "value" : [ {
      "id" : 123456,
      "level" : 1,
      "name" : "SDI",
      "type" : "THIRD_NF",
      "description" : "SDI",
      "is_default" : true,
      "disabled_customized_field_ids" : [ ]
    }, {
      "id" : 123457,
      "level" : 3,
      "name" : "DWR",
      "type" : "DIMENSION",
      "is_default" : true,
      "description" : "DWR",
      "disabled_customized_field_ids" : [ ]
    }, {
      "id" : 123458,
      "level" : 3,
      "name" : "DM",
      "type" : "DM",
      "is_default" : true,
      "description" : "DM",
      "disabled_customized_field_ids" : [ ]
    } ]
  }
}

Status code: 400

BadRequest

{
  "error_code" : "DS.60xx",
  "error_msg" : "The user request is illegal."
}

Status code: 401

Unauthorized

{
  "error_code" : "DS.60xx",
  "error_msg" : "User authentication failed."
}

Status code: 403

Forbidden

{
  "error_code" : "DS.60xx",
  "error_msg" : "The user does not have permission to call this API."
}

Status code: 404

Not Found

{
  "error_code" : "DS.60xx",
  "error_msg" : "The User Request API does not exist."
}

SDK Sample Code

The SDK sample code is as follows.

Modify a data warehouse layer based on parameters.

 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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.dataartsstudio.v1.region.DataArtsStudioRegion;
import com.huaweicloud.sdk.dataartsstudio.v1.*;
import com.huaweicloud.sdk.dataartsstudio.v1.model.*;

import java.util.List;
import java.util.ArrayList;

public class UpdateDesignDataLayersSolution {

    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);

        DataArtsStudioClient client = DataArtsStudioClient.newBuilder()
                .withCredential(auth)
                .withRegion(DataArtsStudioRegion.valueOf("<YOUR REGION>"))
                .build();
        UpdateDesignDataLayersRequest request = new UpdateDesignDataLayersRequest();
        DataLayerVOList body = new DataLayerVOList();
        List<DataLayerVO> listbodyLevels = new ArrayList<>();
        listbodyLevels.add(
            new DataLayerVO()
                .withId("123456")
                .withLevel(1)
                .withName("SDI")
                .withType(DataLayerVO.TypeEnum.fromValue("THIRD_NF"))
                .withDescription("SDI")
                .withIsDefault(true)
                .withDisabledCustomizedFieldIds()
        );
        listbodyLevels.add(
            new DataLayerVO()
                .withId("123457")
                .withLevel(3)
                .withName("DWR")
                .withType(DataLayerVO.TypeEnum.fromValue("DIMENSION"))
                .withDescription("DWR")
                .withIsDefault(true)
                .withDisabledCustomizedFieldIds()
        );
        listbodyLevels.add(
            new DataLayerVO()
                .withId("123458")
                .withLevel(3)
                .withName("DM")
                .withType(DataLayerVO.TypeEnum.fromValue("DM"))
                .withDescription("DM")
                .withIsDefault(true)
                .withDisabledCustomizedFieldIds()
        );
        body.withLevels(listbodyLevels);
        request.withBody(body);
        try {
            UpdateDesignDataLayersResponse response = client.updateDesignDataLayers(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());
        }
    }
}

Modify a data warehouse layer based on parameters.

 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
52
53
54
55
56
57
58
59
60
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkdataartsstudio.v1.region.dataartsstudio_region import DataArtsStudioRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkdataartsstudio.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 = DataArtsStudioClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(DataArtsStudioRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = UpdateDesignDataLayersRequest()
        listLevelsbody = [
            DataLayerVO(
                id="123456",
                level=1,
                name="SDI",
                type="THIRD_NF",
                description="SDI",
                is_default=True,
            ),
            DataLayerVO(
                id="123457",
                level=3,
                name="DWR",
                type="DIMENSION",
                description="DWR",
                is_default=True,
            ),
            DataLayerVO(
                id="123458",
                level=3,
                name="DM",
                type="DM",
                description="DM",
                is_default=True,
            )
        ]
        request.body = DataLayerVOList(
            levels=listLevelsbody
        )
        response = client.update_design_data_layers(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Modify a data warehouse layer based on parameters.

 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    dataartsstudio "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/v1/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/dataartsstudio/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 := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := dataartsstudio.NewDataArtsStudioClient(
        dataartsstudio.DataArtsStudioClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.UpdateDesignDataLayersRequest{}
	idLevels:= "123456"
	typeLevels:= model.GetDataLayerVoTypeEnum().THIRD_NF
	descriptionLevels:= "SDI"
	isDefaultLevels:= true
	idLevels1:= "123457"
	typeLevels1:= model.GetDataLayerVoTypeEnum().DIMENSION
	descriptionLevels1:= "DWR"
	isDefaultLevels1:= true
	idLevels2:= "123458"
	typeLevels2:= model.GetDataLayerVoTypeEnum().DM
	descriptionLevels2:= "DM"
	isDefaultLevels2:= true
	var listLevelsbody = []model.DataLayerVo{
        {
            Id: &idLevels,
            Level: int32(1),
            Name: "SDI",
            Type: &typeLevels,
            Description: &descriptionLevels,
            IsDefault: &isDefaultLevels,
        },
        {
            Id: &idLevels1,
            Level: int32(3),
            Name: "DWR",
            Type: &typeLevels1,
            Description: &descriptionLevels1,
            IsDefault: &isDefaultLevels1,
        },
        {
            Id: &idLevels2,
            Level: int32(3),
            Name: "DM",
            Type: &typeLevels2,
            Description: &descriptionLevels2,
            IsDefault: &isDefaultLevels2,
        },
    }
	request.Body = &model.DataLayerVoList{
		Levels: &listLevelsbody,
	}
	response, err := client.UpdateDesignDataLayers(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

The operation succeeds, and the DataLayerVO array is returned.

400

BadRequest

401

Unauthorized

403

Forbidden

404

Not Found