PutDcdnKvWithHighCapacity_全站加速_API文档

插件下载了解更多
VS Code 插件
安装插件之前,确保已安装 VS Code安装插件之前,确保已安装 VS Code
Alibaba Cloud Developer Toolkit is a collection of extensions that can help access Alibaba Cloud services in Visual Studio Code.
JetBrains 插件
安装插件之前,确保已安装 JetBrains IDE安装插件之前,确保已安装 JetBrains IDE
The Alibaba Cloud Developer Toolkit for JetBrains makes it easier to access Alibaba Cloud services.

接口说明

本接口与 PutDcdnKv 的功能一样,只是允许上传更大请求体。当请求体较小时推荐直接使用 PutDcdnKv 接口,从而减少服务端处理时间。本接口需要使用 SDK 进行调用。以 golang SDK 为例,需要使用 PutDcdnKvWithHighCapacityAdvance 函数进行调用。

func TestPutDcdnKvWithHighCapacity() {
	// 配置初始化
	cfg := new(openapi.Config)
	cfg.SetAccessKeyId("xxxxxxxxx")
	cfg.SetAccessKeySecret("xxxxxxxxxx")
	cli, err := NewClient(cfg)
	if err != nil {
		return err
	}
	runtime := &util.RuntimeOptions{}

	// 构造待上传的键值对请求
	namespace := "test-put-kv"
	key := "test_PutDcdnKvWithHighCapacity_0"
	value := strings.Repeat("t", 10*1024*1024)
	rawReq := &PutDcdnKvRequest{
		Namespace: &namespace,
		Key:       &key,
		Value:     &value,
	}
	payload, err := json.Marshal(rawReq)
	if err != nil {
		return err
	}

	// 如果 payload 大于 2M,则调用大容量接口进行上传
	reqHighCapacity := &PutDcdnKvWithHighCapacityAdvanceRequest{
		Namespace: &namespace,
		Key:       &key,
		UrlObject: bytes.NewReader([]byte(payload)),
	}

	resp, err := cli.PutDcdnKvWithHighCapacityAdvance(reqHighCapacity, runtime)
	if err != nil {
		return err
	}
	return nil
}

流控信息

请求速率为2/1(s)。

授权信息

如下是此API对应的授权信息,用于RAM权限策略语句的Action元素中,为RAM用户或RAM角色授予调用此API的权限。请通过 RAM 访问控制设置,使用方法可参考访问控制帮助文档

具体说明如下:展开详情

操作访问级别资源类型条件关键字关联操作
dcdn:PutDcdnKvWithHighCapacity
Get
全部资源
*

请求参数

字段名称字段详情
Namespacestring

调用 PutDcdnKvNamespace 时指定的名称。

示例值:test_namesapce参考取值来源:
    PutDcdnKvNamespace
Keystring

需要设置的键名称,最长不超过 512 个字符,不能包含空格、反斜杠(/)。

示例值:test_key
Urlstring

存储有需要设置的键值对的下载链接,此参数由调用 SDK 时自动生成,请使用 SDK 进行调用。

示例值:https://xxxobject.oss-cn-reginon.aliyuncs.com/9d91_xxxxxxxxxxx_158bb6e0f97c477791209bb46bd599f7

返回参数

字段名称字段详情
Lengthinteger<int32>

键值对中的值的长度。

示例值:4
Valuestring

键的内容, 超过 256 个字符长度,将取前 100 及后 100 字符并省略中间。

示例值:test
RequestIdstring

请求 ID。

示例值:EEEBE525-F576-1196-8DAF-2D70CA3F4D2F

返回示例

错误码

全局错误码
HTTP 状态码错误码错误信息操作
400
Invalid.Parameter
The specified parameter is invalid.诊断
400
InvalidAccount.Malformed
The specified account is invalid.诊断
400
InvalidNameSpace.Malformed
The specified namespace is invalid.诊断
400
InvalidKey.Malformed
The specified key is invalid.诊断
400
InvalidKey.ExceedsMaximum
The size of the key cannot exceed 512 bytes.诊断
400
InvalidValue.ExceedsMaximum
The size of the value cannot exceed 2,000,000 bytes.诊断
403
InvalidKey.ExceedsCapacity
The maximum capacity of a single namespace cannot exceed 1 GB.诊断
403
Unauthorized.InvalidParameters
The specified authentication parameters are invalid.诊断
403
Unauthorized.InvalidTime
The specified authentication time is invalid.诊断
403
Unauthorized.InvalidToken
Token authentication failed.诊断
403
Unauthorized.InvalidResource
Resource authentication failed.诊断
404
InvalidAccount.NotFound
The specified account does not exist.诊断
404
InvalidNameSpace.NotFound
The specified namespace does not exist.诊断
404
InvalidKey.NotFound
The specified key does not exist.诊断
406
InvalidNameSpace.Duplicate
The specified namespace already exists.诊断
406
InvalidNameSpace.QuotaFull
The maximum number of namespaces is exceeded.诊断
406
InvalidKey.QuotaFull
The maximum number of keys is exceeded.诊断
429
TooManyRequests
Too many requests are submitted.诊断
429
TooQuickRequests
Request for putting or deleting keys are frequently submitted.诊断

变更历史

暂无变更历史

相关示例