Membuat atau memperbarui satu pasangan key-value dalam namespace. Ukuran maksimum permintaan adalah 2 MB.
Coba sekarang
Test
RAM authorization
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| Namespace |
string |
Yes |
Nama namespace. Anda menentukan nama ini saat memanggil operasi CreateKvNamespace. |
test_namespace |
| Key |
string |
Yes |
Key dapat memiliki panjang hingga 512 byte dan tidak boleh mengandung spasi atau garis miring (/). |
test_key |
| Value |
string |
Yes |
Nilai yang akan dikaitkan dengan key. Ukuran maksimum adalah 2 MB (2.000.000 byte). Untuk nilai yang melebihi batas ini, gunakan operasi PutKvWithHighCapacity. |
test_value |
| Expiration |
integer |
No |
Waktu kedaluwarsa untuk pasangan key-value, sebagai timestamp Unix dalam detik. Nilai ini tidak boleh lebih awal dari waktu saat ini. Jika Anda menentukan Expiration dan ExpirationTtl, maka ExpirationTtl yang diutamakan. |
1690081381 |
| ExpirationTtl |
integer |
No |
Time-to-live (TTL) untuk pasangan key-value, dalam detik. Jika Anda menentukan Expiration dan ExpirationTtl, maka ExpirationTtl yang diutamakan. |
3600 |
| Base64 |
boolean |
No |
Menunjukkan apakah parameter Value menggunakan pengkodean Base64. Atur ke true saat menyimpan nilai biner. Jika parameter ini true, Value harus berupa string berkode Base64 yang valid. |
true |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
Objek respons. |
||
| RequestId |
string |
ID permintaan. |
EEEBE525-F576-1196-8DAF-2D70CA3F4D2F |
| Length |
string |
Panjang nilai dalam pasangan key-value. |
4 |
| Value |
string |
Nilai dari pasangan key-value. Jika nilai lebih panjang dari 256 karakter, respons hanya menyertakan 100 karakter pertama dan 100 karakter terakhir. |
test |
Contoh
Respons sukses
JSONformat
{
"RequestId": "EEEBE525-F576-1196-8DAF-2D70CA3F4D2F",
"Length": "4",
"Value": "test"
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 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. | |
| 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. | |
| 429 | TooManyRequests | Too many requests are submitted. | |
| 429 | TooQuickRequests | Request for putting or deleting keys are frequently submitted. |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.