Getting Started
LogQS operates as a REST API service, meaning you can interact with it however you can make HTTPS requests. However, it's much easier to use the LogQS Client Python library. We will use the client for these docs, but be aware that these interactions don't require it.
First, we set up the environment by install lqs-client.
Then, we import the client class.
The LogQS Client requires three parameters to be configured:
LQS_API_URL
The URL of the endpoint for the LogQS API. This should be the base URL for all REST operations, i.e., if the DataStore's API includes a /api
subpath, this should be included.
This parameter can be supplied/overridden with the api_url
parameter.
LQS_API_KEY_ID
The ID of the API Key for which the client will operate as.
This parameter can be supplied/overridden with the api_key_id
parameter.
LQS_API_KEY_SECRET
The secret of the API Key for which the client will operate as.
This parameter can be supplied/overridden with the api_key_secret
parameter.
The client will attempt to load these environment variables automatically upon initilization. It's easiest to use a .env
file with these variables defined, which LogQS will pick up upon intilization.
The API Key can be generated via the admin site. The API URL should be of the form https://<DataStore name>-api.logqs.com/api
.
lqs = LogQS()
# The following is just a sanity check
if lqs._api_url is None:
raise Exception("Environment variables not loaded! Check that a .env file has been added to the runtime.")
assert lqs._api_url.endswith('/api'), "LQS_API_URL should end with '/api'"
assert lqs._api_url.startswith('http'), "LQS_API_URL should start with 'http'"
print(f"Using URL {lqs._api_url} with API Key ID {lqs._api_key_id}.")
Each DataStore has it's own set of API docs accessible at https://<DataStore name>-api.logqs.com/redoc
or https://<DataStore name>-api.logqs.com/docs
. The most up-to-date API docs can be found here.