From 6863967fcd5909b486a570299dce2d315e7fdcd6 Mon Sep 17 00:00:00 2001 From: Jun Lee Date: Tue, 19 Nov 2024 14:19:25 +0000 Subject: [PATCH 1/3] Specifying that the REST APIs support bulk actions. --- src/content/docs/kv/api/delete-key-value-pairs.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/content/docs/kv/api/delete-key-value-pairs.mdx b/src/content/docs/kv/api/delete-key-value-pairs.mdx index f240a31f273850c..ede4552815d6711 100644 --- a/src/content/docs/kv/api/delete-key-value-pairs.mdx +++ b/src/content/docs/kv/api/delete-key-value-pairs.mdx @@ -14,7 +14,7 @@ To delete a key-value pair, call the `delete()` method of the [KV binding](/kv/c env.NAMESPACE.delete(key); ``` -#### Example +#### Example An example of deleting a key-value pair from within a Worker: @@ -68,9 +68,9 @@ Calling the `delete()` method will remove the key and value from your KV namespa ### Delete data in bulk -Delete more than one key-value pair at a time with Wrangler or [via the API](/api/operations/workers-kv-namespace-delete-multiple-key-value-pairs). +Delete more than one key-value pair at a time with Wrangler or [via the REST API](/api/operations/workers-kv-namespace-delete-multiple-key-value-pairs). -The bulk API can accept up to 10,000 KV pairs at once. Bulk writes are not supported using the [KV binding](/kv/concepts/kv-bindings/). +The bulk REST API can accept up to 10,000 KV pairs at once. Bulk writes are not supported using the [KV binding](/kv/concepts/kv-bindings/). ## Other methods to access KV -You can also [delete key-value pairs from the command line with Wrangler](/kv/reference/kv-commands/#delete) or [with the API](/api/operations/workers-kv-namespace-delete-key-value-pair). +You can also [delete key-value pairs from the command line with Wrangler](/kv/reference/kv-commands/#delete) or [with the REST API](/api/operations/workers-kv-namespace-delete-key-value-pair). From ed241af1deb526505c3444637d1fd260fbbd9c16 Mon Sep 17 00:00:00 2001 From: Jun Lee Date: Wed, 20 Nov 2024 11:31:25 +0000 Subject: [PATCH 2/3] Specifying REST API where relevant. Renaming section to "Worker Binding API" --- src/content/docs/kv/api/index.mdx | 2 +- src/content/docs/kv/api/list-keys.mdx | 12 ++++++------ src/content/docs/kv/api/read-key-value-pairs.mdx | 2 +- src/content/docs/kv/api/write-key-value-pairs.mdx | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/content/docs/kv/api/index.mdx b/src/content/docs/kv/api/index.mdx index f05047daa53e2ab..62fc68cd76450a5 100644 --- a/src/content/docs/kv/api/index.mdx +++ b/src/content/docs/kv/api/index.mdx @@ -1,6 +1,6 @@ --- pcx_content_type: navigation -title: API +title: Worker Binding API sidebar: order: 3 group: diff --git a/src/content/docs/kv/api/list-keys.mdx b/src/content/docs/kv/api/list-keys.mdx index a97fa3b2763bc84..fefca467beb7bce 100644 --- a/src/content/docs/kv/api/list-keys.mdx +++ b/src/content/docs/kv/api/list-keys.mdx @@ -13,9 +13,9 @@ To list all the keys in your KV namespace, call the `list()` method of the [KV b env.NAMESPACE.list(); ``` -The `list()` method returns a promise you can `await` on to get the value. +The `list()` method returns a promise you can `await` on to get the value. -#### Example +#### Example An example of listing keys from within a Worker: @@ -63,16 +63,16 @@ env.NAMESPACE.list(options?) #### Response * `response`: `Promise<{ keys: { - name: string, + name: string, expiration?: number, metadata?: object }[], list_complete: boolean, cursor: string }>` - * A `Promise` that resolves to an object containing `keys`, `list_complete`, and `cursor` attributes. + * A `Promise` that resolves to an object containing `keys`, `list_complete`, and `cursor` attributes. * `keys` is an array that contains an object for each key listed. Each object has attributes `name`, `expiration` (optional), and `metadata` (optional). If the key-value pair has an expiration set, the expiration will be present and in absolute value form (even if it was set in TTL form). If the key-value pair has non-null metadata set, the metadata will be present. - * `list_complete` is a boolean, which will be `false` if there are more keys to fetch, even if the `keys` array is empty. + * `list_complete` is a boolean, which will be `false` if there are more keys to fetch, even if the `keys` array is empty. * `cursor` is a `string` used for paginating responses. The `list()` method returns a promise which resolves with an object that looks like the following: @@ -159,4 +159,4 @@ await NAMESPACE.put(key, "", { ``` ## Other methods to access KV -You can also [list keys on the command line with Wrangler](/kv/reference/kv-commands/#list) or [with the API](/api/operations/workers-kv-namespace-list-a-namespace'-s-keys). \ No newline at end of file +You can also [list keys on the command line with Wrangler](/kv/reference/kv-commands/#list) or [with the REST API](/api/operations/workers-kv-namespace-list-a-namespace'-s-keys). \ No newline at end of file diff --git a/src/content/docs/kv/api/read-key-value-pairs.mdx b/src/content/docs/kv/api/read-key-value-pairs.mdx index fc208f8adad05e6..a3d6f96462c86f1 100644 --- a/src/content/docs/kv/api/read-key-value-pairs.mdx +++ b/src/content/docs/kv/api/read-key-value-pairs.mdx @@ -162,5 +162,5 @@ The effective `cacheTtl` of an already cached item can be reduced by getting it ## Other methods to access KV -You can [read key-value pairs from the command line with Wrangler](/kv/reference/kv-commands/#get) and [from the API](/api/operations/workers-kv-namespace-read-key-value-pair). +You can [read key-value pairs from the command line with Wrangler](/kv/reference/kv-commands/#get) and [from the REST API](/api/operations/workers-kv-namespace-read-key-value-pair). diff --git a/src/content/docs/kv/api/write-key-value-pairs.mdx b/src/content/docs/kv/api/write-key-value-pairs.mdx index 93592b659f4ab16..753441be27353ac 100644 --- a/src/content/docs/kv/api/write-key-value-pairs.mdx +++ b/src/content/docs/kv/api/write-key-value-pairs.mdx @@ -84,7 +84,7 @@ Refer to [How KV works](/kv/concepts/how-kv-works/) for more information on this ### Write data in bulk -Write more than one key-value pair at a time with Wrangler or [via the API](/api/operations/workers-kv-namespace-write-multiple-key-value-pairs). +Write more than one key-value pair at a time with Wrangler or [via the REST API](/api/operations/workers-kv-namespace-write-multiple-key-value-pairs). The bulk API can accept up to 10,000 KV pairs at once. @@ -270,4 +270,4 @@ async function retryWithBackoff( ## Other methods to access KV -You can also [write key-value pairs from the command line with Wrangler](/kv/reference/kv-commands/#create) and [write data via the API](/api/operations/workers-kv-namespace-write-key-value-pair-with-metadata). +You can also [write key-value pairs from the command line with Wrangler](/kv/reference/kv-commands/#create) and [write data via the REST API](/api/operations/workers-kv-namespace-write-key-value-pair-with-metadata). From cc96b04d66ecba91e31c64fe3fd9810fe499a479 Mon Sep 17 00:00:00 2001 From: Jun Lee Date: Wed, 20 Nov 2024 15:17:13 +0000 Subject: [PATCH 3/3] Update src/content/docs/kv/api/index.mdx Co-authored-by: Thomas Gauvin <35609369+thomasgauvin@users.noreply.github.com> --- src/content/docs/kv/api/index.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/docs/kv/api/index.mdx b/src/content/docs/kv/api/index.mdx index 62fc68cd76450a5..005242bdc013c63 100644 --- a/src/content/docs/kv/api/index.mdx +++ b/src/content/docs/kv/api/index.mdx @@ -1,6 +1,6 @@ --- pcx_content_type: navigation -title: Worker Binding API +title: Workers Binding API sidebar: order: 3 group: