Domain name for API request: teo.intl.tencentcloudapi.com.
This API is used to write key-value pair data to a specified namespace, with support for setting expiration time. If the key already exists, the original value is overwritten. If not, a new key-value pair is created.
A maximum of 20 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
| Parameter Name | Required | Type | Description |
|---|---|---|---|
| Action | Yes | String | Common Params. The value used for this API: EdgeKVPut. |
| Version | Yes | String | Common Params. The value used for this API: 2022-09-01. |
| Region | No | String | Common Params. This parameter is not required. |
| ZoneId | Yes | String | Zone ID. |
| Namespace | Yes | String | Namespace name. |
| Key | Yes | String | Key name, 1-512 characters long, supports valid UTF-8 characters. |
| Value | Yes | String | Key-value. It cannot be empty and supports up to 1 MB. It supports storing string data. |
| Expiration | No | Integer | Expiration time of the key-value pair. It is an absolute time in seconds, representing the number of seconds elapsed since 00:00:00 (UTC) on January 1, 1970 (Unix timestamp). The value must be greater than or equal to the current time + 60, meaning the Expiration time must be at least 60 seconds from now. If both Expiration and ExpirationTTL are filled in, ExpirationTTL takes precedence. If both are left empty, the key-value pair never expires. |
| ExpirationTTL | No | Integer | Survival time of the key-value pair, relative time, in seconds. It means the data will expire after the specified seconds following the write. Value range: equal to or greater than 60. If both Expiration and ExpirationTTL are filled in, ExpirationTTL takes precedence. If both are left empty, the key-value pair will never expire. |
| Parameter Name | Type | Description |
|---|---|---|
| RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
Write a key-value pair named hello with the value world to the namespace ns-011 of the site zone-3j1xw7910arp, with an expiry timestamp of 1774513200 and a TTL of 3600 seconds.
POST / HTTP/1.1
Host: teo.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: EdgeKVPut
<Common request parameters>
{
"ZoneId": "zone-3j1xw7910arp",
"Namespace": "ns-011",
"Key": "hello",
"Value": "world",
"Expiration": 1774513200,
"ExpirationTTL": 3600
}
{
"Response": {
"RequestId": "5fc4b004-890f-44dc-9c88-e6addd1cf146"
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
| Error Code | Description |
|---|---|
| FailedOperation | Operation failed. |
| ResourceUnavailable.NamespaceNotFound | KV namespace does not exist. |
フィードバック