Skip to content

createAxiomClient

createAxiomClient(opts): object

Defined in: index.ts:12

Creates an Axiom API client with datasets and user groups, both sharing one REST client.

AxiomClientOptions

object

datasets: object

create: (input) => Promise<AxiomDataset>

Create a dataset (POST /v2/datasets).

CreateAxiomDatasetInput

Promise<AxiomDataset>

get: (name) => Promise<AxiomDataset>

Get one dataset by name (GET /v2/datasets/{name}); the name is URL-encoded.

string

Promise<AxiomDataset>

ingest: (name, events) => Promise<unknown>

Send events to a dataset (POST /v1/datasets/{name}/ingest). An empty list ingests nothing, which is how a token’s right to ingest is tried without writing an event.

string

readonly Record<string, unknown>[]

Promise<unknown>

list: () => Promise<AxiomDataset[]>

List the datasets the token can see (GET /v2/datasets).

Promise<AxiomDataset[]>

query: (input) => Promise<unknown>

Run an APL query (POST /v1/datasets/_apl?format=tabular); the dataset is named in the query.

AxiomQueryInput

Promise<unknown>

tokens: object

create: (input) => Promise<AxiomCreatedToken>

Make an API token (POST /v2/tokens). The caller needs a personal access token and the organization id (orgId on the client), and can grant only capabilities it holds itself. The secret token is in the answer once.

CreateAxiomTokenInput

Promise<AxiomCreatedToken>

delete: (id) => Promise<void>

Delete an API token (DELETE /v2/tokens/{id}, answers 204). The id goes in the path through encodeURIComponent. Axiom answers 404 for an id it does not have or one that has expired, which this throws as a ProviderApiError for the caller to read.

string

Promise<void>

user: object

me: () => Promise<AxiomUser>

Get the currently authenticated token’s user.

Promise<AxiomUser>