The Key Value Service enables calling applications to create, read, update, and delete key-value pairs for various purposes (for example, values of dropdown lists in your application). In its most basic form, a key-value pair consists of a key and its value, both of type String. Each key-value pair has two automatically generated fields, namely, the date and time when the record was created and updated, respectively. Also, when creating a key-value pair, you can optionally provide the author’s details (id, name, email, profile).
Access info
|
|
| Endpoint |
https://key-value-api.socrate.io/graphql |
| Required access keys |
Tenant-level service access key |
| Pricing |
Check the available purchase options. |
| Notes |
To call the service, the access key must be provided in the x-api-key header of the HTTP request. If you are using the GraphQL console, you can view the service’s documentation and schema only after entering an access key. Make sure that the scope of the key allows access to the queries and mutations that you require. For example, to grant the key access to all queries and mutations, the keys’s scope must be set to key-value-api:query:* key-value-api:mutation:*. |
Queries
values
Returns previously created key-value pairs, optionally filtered by one or multiple keys, or by the key’s prefix.
Arguments
| Argument |
Type |
Description |
| filter |
KeyValuesFilter |
Optional. Provides filtering options, as KeyValuesFilter type. |
| nextToken |
String |
Optional argument used to fetch the next set of query results. This value can be obtained from the nextToken attribute of the KeyValuesResult type. |
| Attribute |
Type |
Description |
| keys |
[String] |
Optional. The list of keys by which the result should be filtered. |
| keyPrefix |
String |
Optional. Enables filtering the result by a key name’s prefix. |
Result
KeyValuesResult type
| Attribute |
Type |
Description |
| items |
[KeyValue] |
Returns the list of key-value pairs, where each pair is of KeyValue type. |
| nextToken |
String |
If null, then the query has reached the end of the list of results that match the query criteria. If not null, then use this value in the nextToken input argument, with the same filter, to fetch the next set of results. |
KeyValue type
| Attribute |
Type |
Description |
| key |
String |
The name of the key. |
| value |
String |
The value of the key. |
| author |
Author |
Stores details about the author of the key-value pair, as an Author type. |
| createdAt |
DateTime |
The date and time when the record was created. |
| updatedAt |
DateTime |
The date and time when the record was updated. |
Author type
| Attribute |
Type |
Description |
| id |
ID |
The identifier of the record. |
| name |
String |
The name of the author. |
| email |
String |
The author’s email address. |
| profile |
String |
The author’s profile information. |
version
Returns the API version.
Mutations
createKeyValue
Creates a new key-value pair. Note that, if a key with the same key name exists, it will be overwritten.
Arguments
| Attribute |
Type |
Description |
| input |
CreateKeyValueInput |
Mandatory. Provides input to the mutation, as a CreateKeyValueInput type. |
| Attribute |
Type |
Description |
| key |
String! |
The key’s name. |
| value |
String |
The key’s value. |
| author |
AuthorInput |
Supplies details about the author of the record, as AuthorInput type. |
| Attribute |
Type |
Description |
| id |
ID |
The identifier of the record. |
| name |
String |
The name of the author. |
| email |
String |
The author’s email address. |
| profile |
String |
The author’s profile information. |
Result
See the KeyValue type.
deleteKeyValue
Arguments
| Attribute |
Type |
Description |
| key |
String! |
Mandatory. Provides the ID of the key to be deleted. |
Result
See the KeyValue type.
updateKeyValue
Updates an existing key-value pair.
Arguments
| Attribute |
Type |
Description |
| input |
UpdateKeyValueInput |
Mandatory. Provides input to the mutation, as a CreateKeyValueInput type. |
| Attribute |
Type |
Description |
| key |
String! |
The key’s name. |
| value |
String |
The key’s value. |
| author |
AuthorInput |
The author’s details, as AuthorInput type. |
Result
See the KeyValue type.