You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To set up the key-value store collections using a single configuration file, use the following template for the `.actor/actor.json` configuration:
38
+
To set up the key-value store schema using a single configuration file, use the following template for the `.actor/actor.json` configuration:
39
39
40
40
```json title=".actor/actor.json"
41
41
{
@@ -46,7 +46,6 @@ To set up the key-value store collections using a single configuration file, use
46
46
"storages": {
47
47
"keyValueStore": {
48
48
"actorKeyValueStoreSchemaVersion": 1,
49
-
"actorSpecification": 1,
50
49
"title": "Key-Value Store Schema",
51
50
"collections": {
52
51
"documents": {
@@ -70,17 +69,21 @@ The template above defines the configuration for the default key-value store.
70
69
Each collection can define its member keys using one of the following properties:
71
70
72
71
-`keyPrefix` - All keys starting with the specified prefix will be included in the collection (e.g., all keys starting with "document-").
73
-
-`key` - A specific individual key that will be included in the collection (e.g., exactly "summary-data").
72
+
-`key` - A specific individual key that will be included in the collection.
74
73
75
74
Note that you must use either `key` or `keyPrefix` for each collection, but not both.
76
75
77
-
Under the `Storage` tab property of the run or in the key-value store storage detail, there are the tabs for each collection defined in the configuration:
76
+
Once the key-value store schema is defined, the tabs for each collection will appear in the `Storage` tab of the Actor's run:
You can use the API to list keys from a specific collection by using the `collection` query parameter when calling the [Get list of keys](https://docs.apify.com/api/v2/key-value-store-keys-get) endpoint:
86
+
With the key-value store schema defined, you can use the API to list keys from a specific collection by using the `collection` query parameter when calling the [Get list of keys](https://docs.apify.com/api/v2/key-value-store-keys-get) endpoint:
84
87
85
88
```http title="Get list of keys from a collection"
86
89
GET https://api.apify.com/v2/key-value-stores/{storeId}/keys?collection=documents
@@ -141,7 +144,7 @@ You have two choices of how to organize files within the `.actor` folder.
141
144
"keyValueStore": {
142
145
"actorKeyValueStoreSchemaVersion": 1,
143
146
"title": "Key-Value Store Schema",
144
-
"collections": {}
147
+
"collections": {/* Define your collections here */ }
145
148
}
146
149
}
147
150
}
@@ -165,35 +168,35 @@ You have two choices of how to organize files within the `.actor` folder.
165
168
{
166
169
"actorKeyValueStoreSchemaVersion": 1,
167
170
"title": "Key-Value Store Schema",
168
-
"collections": {}
171
+
"collections": {/* Define your collections here */ }
169
172
}
170
173
```
171
174
172
175
Both of these methods are valid so choose one that suits your needs best.
173
176
174
177
## Key-value store schema structure definitions
175
178
176
-
The key-value store schema structure defines the various components and properties that govern the organization and representation of the output data produced by an Actor.
177
-
It specifies the structure of the data, the transformations to be applied, and the visual display configurations for the Output tab UI.
179
+
The key-value store schema defines the collections of keys (and their properties) in the key-value store.
180
+
It allows you to organize and validate data stored by the Actor, making it easier to manage and retrieve specific records.
|`actorKeyValueStoreSchemaVersion`| integer | true | Specifies the version of key-value store schema structure document. <br/>Currently only version 1 is available. |
184
-
|`title`| string | true |-|
185
-
|`description`| string | false |-|
186
-
|`collections`| Object | true | An object where each key is a collection ID and its value is a collection definition object. |
187
+
|`title`| string | true |Title of the schema. Currently not used anywhere. |
188
+
|`description`| string | false |Description of the schema. Currently not used anywhere. |
189
+
|`collections`| Object | true | An object where each key is a collection ID and its value is a collection definition object (see below).|
|`title`| string| true | The title displayed in the UI in the Output tab <br/>and returned in the API. |
193
-
|`description`| string| false | A description of the collection that appears in tooltips in the UI and in API responses.|
194
-
|`key`| string | conditional*| Defines a single specific key that will be part of this collection. |
195
-
|`keyPrefix`| string | conditional*| Defines a prefix for keys that should be included in this collection. |
196
-
|`contentTypes`| string array | false | Allowed content types for records in this collection. Used for validation when storing data. |
197
-
|`jsonSchema`| object| false | For collections with content type `application/json`, you can define a JSON schema to validate structure. <br/>Uses JsonSchema Draft 07 format.|
|`title`| string| true| The collection’s title is shown in the storage tab of a run and in the storage detail view, where it appears as a tab for filtering records.|
196
+
|`description`| string| false| A description of the collection that appears in tooltips in the UI. |
197
+
|`key`| string | conditional*| Defines a single specific key that will be part of this collection.|
198
+
|`keyPrefix`| string | conditional*| Defines a prefix for keys that should be included in this collection.|
199
+
|`contentTypes`| string array | false| Allowed content types for records in this collection. Used for validation when storing data. |
200
+
|`jsonSchema`| object| false| For collections with content type `application/json`, you can define a JSON schema to validate structure. <br/>Uses JsonSchema Draft 07 format. |
198
201
199
202
\* Either `key` or `keyPrefix` must be specified for each collection, but not both.
0 commit comments