From 871e7d6c46a96066e94e66d6f019b47c2b3874e8 Mon Sep 17 00:00:00 2001 From: Yaron Schneider Date: Wed, 12 Aug 2020 14:15:00 -0700 Subject: [PATCH] Update state_api.md (#735) --- reference/api/state_api.md | 60 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/reference/api/state_api.md b/reference/api/state_api.md index 287f0f8c2..df51cb325 100644 --- a/reference/api/state_api.md +++ b/reference/api/state_api.md @@ -5,6 +5,7 @@ - [Key Scheme](#key-scheme) - [Save State](#save-state) - [Get State](#get-state) +- [Get Bulk State](#get-bulk-state) - [Delete State](#delete-state) - [Configuring State Store for Actors](#configuring-state-store-for-actors) - [Optional Behaviors](#optional-behaviors) @@ -169,6 +170,65 @@ curl http://localhost:3500/v1.0/state/starwars/planet \ } ``` +## Get bulk state + +This endpoint lets you get a list of values for a given list of keys. + +### HTTP Request + +```http +POST http://localhost:/v1.0/state//bulk +``` + +#### URL Parameters + +Parameter | Description +--------- | ----------- +daprPort | the Dapr port +storename | ```metadata.name``` field in the user configured state store component yaml. Please refer Dapr State Store configuration structure mentioned above. +consistency | (optional) read consistency mode, see [state operation options](#optional-behaviors) + +### HTTP Response + +#### Response Codes + +Code | Description +---- | ----------- +200 | Get state successful +400 | State store is missing or misconfigured +500 | Get bulk state failed + +#### Response Body +An array of JSON-encoded values + +### Example + +```shell +curl http://localhost:3500/v1.0/state/myRedisStore/bulk \ + -H "Content-Type: application/json" + -d '{ + "keys": [ "key1", "key2" ], + "parallelism": 10, + }' +``` + +> The above command returns an array of key/value objects: + +```json +[ + { + "key": "key1", + "data": "value1", + "etag": "1" + }, + { + "key": "key2", + "data": "value2", + "etag": "1" + }, +] +``` + ## Delete state This endpoint lets you delete the state for a specific key.