更新时间:2026-09-09 GMT+08:00
分享

更新API - UpdateApi

功能介绍

更新API。

调用方法

请参见如何调用API。

授权信息

账号具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备调用API所需的权限。

  • 如果使用角色与策略授权,具体权限要求请参见权限和授权项。
  • 如果使用身份策略授权,当前API调用无需身份策略权限。

URI

PUT /v1/{project_id}/service/apis/{api_id}

表1 路径参数

参数

是否必选

参数类型

描述

project_id

是

String

项目ID,获取方法请参见项目ID和账号ID。

api_id

是

String

API ID。

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

是

String

用户Token,使用Token认证时必选。通过调用IAM服务的“获取用户Token”接口获取响应消息头中X-Subject-Token的值。

workspace

是

String

工作空间ID,获取方法请参见实例ID和工作空间ID。

Dlm-Type

否

String

数据服务的版本类型,指定SHARED共享版或EXCLUSIVE专享版。

Content-Type

是

String

消息体的类型(格式),有Body体的情况下必选,没有Body体无需填写。如果请求消息体中含有中文字符,则需要通过charset=utf8指定中文字符集,例如取值为:application/json;charset=utf8。

表3 请求Body参数

参数

是否必选

参数类型

描述

catalog_id

否

String

目录ID。

name

否

String

API名称。

description

否

String

API描述。

log_flag

否

Boolean

是否启用访问日志。

api_type

否

String

API类型。

枚举值:

  • API_SPECIFIC_TYPE_CONFIGURATION: 配置类API

  • API_SPECIFIC_TYPE_SCRIPT: 脚本类API

  • API_SPECIFIC_TYPE_MYBATIS: MyBatis类API

  • API_SPECIFIC_TYPE_GROOVY: Groovy类API

  • API_SPECIFIC_TYPE_REGISTER:注册类API

  • API_SPECIFIC_TYPE_ORCHESTRATE:编排类API

  • API_TYPE_CREATE:创建类API(已弃用)

  • API_TYPE_REGISTER:注册类API(已弃用)

auth_type

否

String

认证类型。

枚举值:

  • APP: app secret认证

  • IAM: IAM token认证

  • NONE: 无认证

retention_period

否

Integer

最低保留期限,单位小时。

manager

否

String

API审核人。

path

否

String

API路径。

protocol

否

String

API请求协议类型。

枚举值:

  • PROTOCOL_TYPE_HTTP:HTTP协议请求

  • PROTOCOL_TYPE_HTTPS:HTTPS协议请求

request_type

否

String

请求类型。

枚举值:

  • REQUEST_TYPE_POST:POST请求

  • REQUEST_TYPE_GET:GET请求

tags

否

Array of strings

标签。

visibility

否

String

API可见性。

枚举值:

  • WORKSPACE: 工作空间可见

  • PROJECT: 项目可见

  • DOMAIN: 租户可见

publish_type

否

String

发布类型(已弃用)。

枚举值:

  • PUBLISH_TYPE_PUBLIC:公开

  • PUBLISH_TYPE_PRIVATE:私有

data_mask_switch

否

Boolean

数据脱敏开关。

data_mask_paras

否

Array of DataMaskParas objects

数据脱敏配置。

body

否

String

请求体内容描述,仅注册类API使用。

datasource_config_list

否

Array of DatasourceConfig objects

多数据源配置信息,仅Groovy类API使用。

groovy_content

否

String

Groovy文本,仅Groovy类API使用。

request_paras

否

Array of RequestPara objects

API请求参数列表。

datasource_config

否

DatasourceConfig object

API数据源配置。

backend_config

否

BackendConfig object

API后端配置。仅注册类API使用

表4 DataMaskParas

参数

是否必选

参数类型

描述

column_name

否

String

敏感字段。

algorithm_name

否

String

算法名称。

algorithm_type

否

String

算法类型。

en_name

否

String

算法英文名称。

algorithm_parameters

否

String

参数。

failure_policy

否

String

失败策略。

枚举值:

  • SKIP:跳过, 即不做处理

  • INTERRUPT_AND_EXCEPTION:中断并抛出异常

  • SET_NULL:置空

  • DEFAULT_VALUE:默认值

表5 DatasourceConfig

参数

是否必选

参数类型

描述

type

否

String

数据源的类型。

枚举值:

  • MYSQL:MYSQL数据源

  • DLI:DLI数据源

  • DWS:DWS数据源

  • HIVE:HIVE数据源

  • HBASE:HBASE数据源

connection_name

否

String

数据连接名称。

connection_id

否

String

数据连接ID。

database

否

String

数据库名。

datatable

否

String

数据表名称。

table_id

否

String

数据表ID。

queue

否

String

DLI的队列名称。

access_mode

否

String

获取数据的模式。

枚举值:

  • SQL:SQL取数方式

  • ROW_KEY:ROW_KEY取数方式 仅适用于HBASE

  • PREFIX_FILTER:PREFIX_FILTER取数方式仅适用于HBASE

access_type

否

String

取数方式(已弃用)。

枚举值:

  • SCRIPT:脚本方式

  • CONFIGURATION:配置方式

pagination

否

String

分页方式。

枚举值:

  • DEFAULT:默认分页

  • CUSTOM:自定义分页

sql

否

String

脚本模式下的SQL语句。

backend_paras

否

Array of ApiRequestPara objects

API后端参数。

response_paras

否

Array of ApiResponsePara objects

配置类API返回参数。

order_paras

否

Array of DatasourceOrderPara objects

排序参数。

total_size_sql

否

String

总条数计算脚本SQL。

表6 RequestPara

参数

是否必选

参数类型

描述

name

否

String

参数名。

position

否

String

参数的位置。

枚举值:

  • REQUEST_PARAMETER_POSITION_PATH:请求PATH内参数

  • REQUEST_PARAMETER_POSITION_HEADER:请求HEADER内参数

  • REQUEST_PARAMETER_POSITION_QUERY:请求QUERY参数

  • REQUEST_PARAMETER_POSITION_BODY:请求BODY参数

  • REQUEST_PARAMETER_POSITION_STATIC:静态参数

type

否

String

常量参数类型。

枚举值:

  • REQUEST_PARAMETER_TYPE_NUMBER:数值类型

  • REQUEST_PARAMETER_TYPE_STRING:字符串类型

description

否

String

参数的描述。

necessary

否

Boolean

参数是否必填。

example_value

否

String

示例值。

default_value

否

String

默认值。

support_null

否

Boolean

支持NULL值。

verification_type

否

String

校验类型。

枚举值:

  • REQUEST_PARAMETER_VERIFICATION_NUMERIC_RANGE:数值范围

  • REQUEST_PARAMETER_VERIFICATION_LENGTH_RANGE:长度范围

  • REQUEST_PARAMETER_VERIFICATION_ENUM:枚举

  • REQUEST_PARAMETER_VERIFICATION_REGULAR_EXPRESSION:正则表达式

verification_expression

否

String

校验规则。

表7 ApiRequestPara

参数

是否必选

参数类型

描述

name

否

String

参数名称。

mapping

否

String

映射字段。

condition

否

String

操作符。

枚举值:

  • CONDITION_TYPE_EQ:等于

  • CONDITION_TYPE_NE:不等于

  • CONDITION_TYPE_GT:大于

  • CONDITION_TYPE_GE:大于等于

  • CONDITION_TYPE_LT:小于

  • CONDITION_TYPE_LE:小于等于

  • CONDITION_TYPE_LIKE:模糊查询如:%like%

  • CONDITION_TYPE_LIKE_L:模糊查询如:%like

  • CONDITION_TYPE_LIKE_R:模糊查询如:like%

表8 ApiResponsePara

参数

是否必选

参数类型

描述

name

否

String

参数名。

field

否

String

绑定的表字段。

type

否

String

常量参数类型。

枚举值:

  • REQUEST_PARAMETER_TYPE_NUMBER:数值类型

  • REQUEST_PARAMETER_TYPE_STRING:字符串类型

description

否

String

参数描述。

example_value

否

String

参数示例值。

表9 DatasourceOrderPara

参数

是否必选

参数类型

描述

name

否

String

排序参数名称。

field

否

String

对应的参数字段。

optional

否

Boolean

是否可选。

sort

否

String

排序方式。

枚举值:

  • ASC: 升序

  • DESC: 降序

  • CUSTOM: 自定义

order

否

Integer

排序参数顺序。

description

否

String

排序参数描述信息。

表10 BackendConfig

参数

是否必选

参数类型

描述

type

否

String

请求类型。

  • REQUEST_TYPE_POST:POST请求

  • REQUEST_TYPE_GET:GET请求

protocol

否

String

API请求协议类型。

  • PROTOCOL_TYPE_HTTP:HTTP协议请求

  • PROTOCOL_TYPE_HTTPS:HTTPS协议请求

host

否

String

后端HOST。

timeout

否

Integer

后端超时时间。

path

否

String

后端请求PATH。

backend_paras

否

Array of BackendRequestPara objects

API后端参数。

constant_paras

否

Array of BackendConstant objects

后端常量参数。

表11 BackendRequestPara

参数

是否必选

参数类型

描述

name

否

String

API请求参数名称。

position

否

String

参数的位置。

枚举值:

  • REQUEST_PARAMETER_POSITION_PATH:请求PATH内参数

  • REQUEST_PARAMETER_POSITION_HEADER:请求HEADER内参数

  • REQUEST_PARAMETER_POSITION_QUERY:请求QUERY参数

backend_para_name

否

String

对应的后端参数。

表12 BackendConstant

参数

是否必选

参数类型

描述

name

否

String

常量参数名。

type

否

String

常量参数类型。

枚举值:

  • REQUEST_PARAMETER_TYPE_NUMBER:数值类型

  • REQUEST_PARAMETER_TYPE_STRING:字符串类型

position

否

String

参数的位置。

枚举值:

  • REQUEST_PARAMETER_POSITION_PATH:请求PATH内参数

  • REQUEST_PARAMETER_POSITION_HEADER:请求HEADER内参数

  • REQUEST_PARAMETER_POSITION_QUERY:请求QUERY参数

description

否

String

常量参数描述。

value

否

String

常量参数值。

响应参数

状态码:204

Success。

状态码:400

表13 响应Body参数

参数

参数类型

描述

error_code

String

错误码。

error_msg

String

错误描述。

请求示例

更新Id为10e3a4b67f59a9efe64e6bb31859221f的API信息。

/v1/0833a5737480d53b2f250010d01a7b88/service/apis/10e3a4b67f59a9efe64e6bb31859221f

{
  "catalog_id" : "0",
  "name" : "create_test0010001",
  "description" : "dws",
  "log_flag" : false,
  "auth_type" : "APP",
  "retention_period" : 0,
  "publish_type" : "PUBLISH_TYPE_PRIVATE",
  "manager" : "user",
  "path" : "/creat_test001/{p}",
  "api_type" : "API_SPECIFIC_TYPE_SCRIPT",
  "protocol" : "PROTOCOL_TYPE_HTTPS",
  "request_type" : "REQUEST_TYPE_GET",
  "request_paras" : [ {
    "name" : "p",
    "position" : "REQUEST_PARAMETER_POSITION_PATH",
    "type" : "REQUEST_PARAMETER_TYPE_NUMBER",
    "description" : "test",
    "necessary" : true,
    "example_value" : null,
    "support_null" : true,
    "default_value" : null
  } ],
  "datasource_config" : {
    "type" : "CLICKHOUSE",
    "connection_name" : "clickhouse_ywx1119238_safe",
    "connection_id" : "3d0d5941f2cb4ef08abecc01e33eabec",
    "database" : "system",
    "queue" : "dayu",
    "access_type" : "CONNECTION_TYPE_SCRIPT",
    "access_mode" : "SQL",
    "sql" : "c2VsZWN0IDEgYXMgbnVtOw==",
    "backend_paras" : [ ],
    "order_paras" : [ ],
    "pagination" : "DEFAULT"
  },
  "visibility" : "WORKSPACE"
}

响应示例

无

SDK代码示例

SDK代码示例如下。

更新Id为10e3a4b67f59a9efe64e6bb31859221f的API信息。

 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
84
85
86
87
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 UpdateApiSolution {

    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();
        UpdateApiRequest request = new UpdateApiRequest();
        request.withApiId("{api_id}");
        Api body = new Api();
        DatasourceConfig datasourceConfigbody = new DatasourceConfig();
        datasourceConfigbody.withType(DatasourceConfig.TypeEnum.fromValue("CLICKHOUSE"))
            .withConnectionName("clickhouse_ywx1119238_safe")
            .withConnectionId("3d0d5941f2cb4ef08abecc01e33eabec")
            .withDatabase("system")
            .withQueue("dayu")
            .withAccessType(DatasourceConfig.AccessTypeEnum.fromValue("CONNECTION_TYPE_SCRIPT"))
            .withAccessMode(DatasourceConfig.AccessModeEnum.fromValue("SQL"))
            .withPagination(DatasourceConfig.PaginationEnum.fromValue("DEFAULT"))
            .withSql("c2VsZWN0IDEgYXMgbnVtOw==");
        List<RequestPara> listbodyRequestParas = new ArrayList<>();
        listbodyRequestParas.add(
            new RequestPara()
                .withName("p")
                .withPosition(RequestPara.PositionEnum.fromValue("REQUEST_PARAMETER_POSITION_PATH"))
                .withType(RequestPara.TypeEnum.fromValue("REQUEST_PARAMETER_TYPE_NUMBER"))
                .withDescription("test")
                .withNecessary(true)
                .withSupportNull(true)
        );
        body.withDatasourceConfig(datasourceConfigbody);
        body.withRequestParas(listbodyRequestParas);
        body.withPublishType(Api.Api.fromValue("PUBLISH_TYPE_PRIVATE"));
        body.withVisibility(Api.Api.fromValue("WORKSPACE"));
        body.withRequestType(Api.Api.fromValue("REQUEST_TYPE_GET"));
        body.withProtocol(Api.Api.fromValue("PROTOCOL_TYPE_HTTPS"));
        body.withPath("/creat_test001/{p}");
        body.withManager("user");
        body.withRetentionPeriod(0);
        body.withAuthType(Api.Api.fromValue("APP"));
        body.withApiType(Api.Api.fromValue("API_SPECIFIC_TYPE_SCRIPT"));
        body.withLogFlag(false);
        body.withDescription("dws");
        body.withName("create_test0010001");
        body.withCatalogId("0");
        request.withBody(body);
        try {
            UpdateApiResponse response = client.updateApi(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());
        }
    }
}

更新Id为10e3a4b67f59a9efe64e6bb31859221f的API信息。

 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
# 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 = UpdateApiRequest()
        request.api_id = "{api_id}"
        datasourceConfigbody = DatasourceConfig(
            type="CLICKHOUSE",
            connection_name="clickhouse_ywx1119238_safe",
            connection_id="3d0d5941f2cb4ef08abecc01e33eabec",
            database="system",
            queue="dayu",
            access_type="CONNECTION_TYPE_SCRIPT",
            access_mode="SQL",
            pagination="DEFAULT",
            sql="c2VsZWN0IDEgYXMgbnVtOw=="
        )
        listRequestParasbody = [
            RequestPara(
                name="p",
                position="REQUEST_PARAMETER_POSITION_PATH",
                type="REQUEST_PARAMETER_TYPE_NUMBER",
                description="test",
                necessary=True,
                support_null=True
            )
        ]
        request.body = Api(
            datasource_config=datasourceConfigbody,
            request_paras=listRequestParasbody,
            publish_type="PUBLISH_TYPE_PRIVATE",
            visibility="WORKSPACE",
            request_type="REQUEST_TYPE_GET",
            protocol="PROTOCOL_TYPE_HTTPS",
            path="/creat_test001/{p}",
            manager="user",
            retention_period=0,
            auth_type="APP",
            api_type="API_SPECIFIC_TYPE_SCRIPT",
            log_flag=False,
            description="dws",
            name="create_test0010001",
            catalog_id="0"
        )
        response = client.update_api(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

更新Id为10e3a4b67f59a9efe64e6bb31859221f的API信息。

  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
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
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, err := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        SafeBuild()

    if err != nil {
        fmt.Println(err)
        return
    }

    hcClient, err := dataartsstudio.DataArtsStudioClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()


    if err != nil {
        fmt.Println(err)
        return
    }

    client := dataartsstudio.NewDataArtsStudioClient(hcClient)

    request := &model.UpdateApiRequest{}
	request.ApiId = "{api_id}"
	typeDatasourceConfig:= model.GetDatasourceConfigTypeEnum().CLICKHOUSE
	connectionNameDatasourceConfig:= "clickhouse_ywx1119238_safe"
	connectionIdDatasourceConfig:= "3d0d5941f2cb4ef08abecc01e33eabec"
	databaseDatasourceConfig:= "system"
	queueDatasourceConfig:= "dayu"
	accessTypeDatasourceConfig:= model.GetDatasourceConfigAccessTypeEnum().CONNECTION_TYPE_SCRIPT
	accessModeDatasourceConfig:= model.GetDatasourceConfigAccessModeEnum().SQL
	paginationDatasourceConfig:= model.GetDatasourceConfigPaginationEnum().DEFAULT
	sqlDatasourceConfig:= "c2VsZWN0IDEgYXMgbnVtOw=="
	datasourceConfigbody := &model.DatasourceConfig{
		Type: &typeDatasourceConfig,
		ConnectionName: &connectionNameDatasourceConfig,
		ConnectionId: &connectionIdDatasourceConfig,
		Database: &databaseDatasourceConfig,
		Queue: &queueDatasourceConfig,
		AccessType: &accessTypeDatasourceConfig,
		AccessMode: &accessModeDatasourceConfig,
		Pagination: &paginationDatasourceConfig,
		Sql: &sqlDatasourceConfig,
	}
	nameRequestParas:= "p"
	positionRequestParas:= model.GetRequestParaPositionEnum().REQUEST_PARAMETER_POSITION_PATH
	typeRequestParas:= model.GetRequestParaTypeEnum().REQUEST_PARAMETER_TYPE_NUMBER
	descriptionRequestParas:= "test"
	necessaryRequestParas:= true
	supportNullRequestParas:= true
	var listRequestParasbody = []model.RequestPara{
        {
            Name: &nameRequestParas,
            Position: &positionRequestParas,
            Type: &typeRequestParas,
            Description: &descriptionRequestParas,
            Necessary: &necessaryRequestParas,
            SupportNull: &supportNullRequestParas,
        },
    }
	publishTypeApi:= model.GetApiPublishTypeEnum().PUBLISH_TYPE_PRIVATE
	visibilityApi:= model.GetApiVisibilityEnum().WORKSPACE
	requestTypeApi:= model.GetApiRequestTypeEnum().REQUEST_TYPE_GET
	protocolApi:= model.GetApiProtocolEnum().PROTOCOL_TYPE_HTTPS
	pathApi:= "/creat_test001/{p}"
	managerApi:= "user"
	retentionPeriodApi:= int32(0)
	authTypeApi:= model.GetApiAuthTypeEnum().APP
	apiTypeApi:= model.GetApiApiTypeEnum().API_SPECIFIC_TYPE_SCRIPT
	logFlagApi:= false
	descriptionApi:= "dws"
	nameApi:= "create_test0010001"
	catalogIdApi:= "0"
	request.Body = &model.Api{
		DatasourceConfig: datasourceConfigbody,
		RequestParas: &listRequestParasbody,
		PublishType: &publishTypeApi,
		Visibility: &visibilityApi,
		RequestType: &requestTypeApi,
		Protocol: &protocolApi,
		Path: &pathApi,
		Manager: &managerApi,
		RetentionPeriod: &retentionPeriodApi,
		AuthType: &authTypeApi,
		ApiType: &apiTypeApi,
		LogFlag: &logFlagApi,
		Description: &descriptionApi,
		Name: &nameApi,
		CatalogId: &catalogIdApi,
	}
	response, err := client.UpdateApi(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

204

Success。

400

BadRequest。

相关文档