Provides API endpoints related to api/key value stores/records
Summary
Functions
Delete key-value store record
Get key-value store record
Check if key-value store record exists
Download key-value store records
Set key-value store record
Functions
@spec delete(store_id :: String.t(), record_key :: String.t(), opts :: keyword()) :: :ok | {:error, ApifyClient.Error.t()}
Delete key-value store record
Removes a record specified by a key from the key-value store.
@spec get(store_id :: String.t(), record_key :: String.t(), opts :: keyword()) :: {:ok, any()} | {:error, ApifyClient.Error.t()}
Get key-value store record
Gets a value stored in the key-value store under a specific key.
The response body has the same Content-Encoding header as it was set in
Set key-value store record.
If the request does not define the Accept-Encoding HTTP header with the
right encoding, the record will be decompressed.
Most HTTP clients support decompression by default. After using the HTTP
client with decompression support, the Accept-Encoding header is set by
the client and body is decompressed automatically.
Please note that for security reasons, Apify API can perform small modifications
to HTML documents before they are served via this endpoint. To fetch the raw HTML
content without any modifications, use the attachment query parameter.
Options
attachment: Iftrueor1, the response will be served withContent-Disposition: attachmentheader, causing web browsers to offer downloading HTML records instead of displaying them.signature: Signature used for the access.
@spec head(store_id :: String.t(), record_key :: String.t(), opts :: keyword()) :: :ok | {:error, ApifyClient.Error.t()}
Check if key-value store record exists
Check if a value is stored in the key-value store under a specific key.
@spec list(store_id :: String.t(), opts :: keyword()) :: {:ok, binary()} | {:error, ApifyClient.Error.t()}
Download key-value store records
Downloads all records from the key-value store as a ZIP archive. Each record is stored as a separate file in the archive, with the filename equal to the record key.
You can optionally filter the records by collection or prefix to download only a subset of the store.
Options
collection: If specified, only records belonging to a specific collection from the key-value store schema. The key-value store need to have a schema defined for this parameter to work.prefix: If specified, only records whose key starts with the given prefix are included in the archive.signature: Signature used for the access.
@spec update( store_id :: String.t(), record_key :: String.t(), body :: any(), opts :: keyword() ) :: {:ok, map() | nil} | {:error, ApifyClient.Error.t()}
Set key-value store record
Stores a value under a specific key to the key-value store.
The value is passed as the PUT payload and it is stored with a MIME content
type defined by the Content-Type header and with encoding defined by the
Content-Encoding header.
To save bandwidth, storage, and speed up your upload, send the request
payload compressed with Gzip compression and add the Content-Encoding: gzip
header. It is possible to set up another compression type with Content-Encoding
request header.
Below is a list of supported Content-Encoding types.
- Brotli compression:
Content-Encoding: br - Gzip compression:
Content-Encoding: gzip - Zstandard compression:
Content-Encoding: zstd - Deflate compression:
Content-Encoding: deflate
Request Body
Content Types: */*, application/json