QlikElixir.REST.APIKeys (qlik_elixir v0.3.5)
View SourceREST API client for Qlik Cloud API Keys.
Provides functions to manage API keys for programmatic access to Qlik Cloud.
Examples
# List all API keys
{:ok, %{"data" => keys}} = APIKeys.list(config: config)
# Create a new API key
{:ok, key} = APIKeys.create(%{description: "My API Key"}, config: config)
# key["token"] contains the generated JWT token (only shown once)
# Delete an API key
:ok = APIKeys.delete("key-123", config: config)
# Get tenant configuration (requires tenant ID from Tenants.me)
{:ok, tenant} = Tenants.me(config: config)
{:ok, config} = APIKeys.get_config(tenant["id"], config: config)
Summary
Functions
Creates a new API key.
Deletes an API key.
Gets an API key by ID.
Gets the API keys configuration for a tenant.
Lists all API keys.
Updates an API key.
Updates the API keys configuration for a tenant.
Functions
@spec create( map(), keyword() ) :: {:ok, map()} | {:error, QlikElixir.Error.t()}
Creates a new API key.
Parameters
params- Map with key details::description- Required. Description of the key.:expiry- Optional. Expiration timestamp (ISO 8601).:sub- Optional. Subject to generate key for (admin only).
Returns
The response includes a token field containing the JWT token.
This token is only shown once and cannot be retrieved again.
@spec delete( String.t(), keyword() ) :: :ok | {:error, QlikElixir.Error.t()}
Deletes an API key.
@spec get( String.t(), keyword() ) :: {:ok, map()} | {:error, QlikElixir.Error.t()}
Gets an API key by ID.
@spec get_config( String.t(), keyword() ) :: {:ok, map()} | {:error, QlikElixir.Error.t()}
Gets the API keys configuration for a tenant.
Parameters
tenant_id- The tenant ID. UseTenants.me/1to get the current tenant ID.
Examples
{:ok, tenant} = Tenants.me(config: config)
{:ok, config} = APIKeys.get_config(tenant["id"], config: config)
@spec list(keyword()) :: {:ok, map()} | {:error, QlikElixir.Error.t()}
Lists all API keys.
Options
:config- Required. The configuration struct.:limit- Maximum number of results per page.:next- Cursor for pagination.:owner_id- Filter by owner ID.:status- Filter by status ("active", "expired", "revoked").:sort- Sort field and direction (e.g., "-createdAt").
@spec update(String.t(), map(), keyword()) :: {:ok, map()} | {:error, QlikElixir.Error.t()}
Updates an API key.
Parameters
key_id- The API key ID.params- Map with fields to update::description- New description.
@spec update_config(String.t(), map(), keyword()) :: {:ok, map()} | {:error, QlikElixir.Error.t()}
Updates the API keys configuration for a tenant.
Parameters
tenant_id- The tenant ID.params- Map with configuration fields::api_keys_enabled- Enable/disable API keys.:max_api_key_expiry- Maximum expiry duration.:max_keys_per_user- Maximum keys per user.