Sifflet CLI - Command Line Interface

The Sifflet CLI is a tool that enables you to interact with the Sifflet application using commands in your command line shell.
With minimal configuration the Sifflet CLI enables you to run commands that implement functionality equivalent to that provided by the browser-based Sifflet application from the command prompt in your terminal program.

To see all available commands of Sifflet's CLI, please refer to this page.

Getting Started

Prerequisites

📘

Access Token

In order to configure your CLI, you will need an Access Token. You can see here how to generate one.

  • Python 3.7 or greater
  • One of these two parameters is required, depending on your type of Sifflet deployment:
    • SaaS deployments: Your Sifflet tenant name. If you access to Sifflet with https://abcdef.siffletdata.com, then your tenant would be abcdef.
    • Self-hosted deployments: Your Sifflet backend URL, i.e. the full URL to the Sifflet backend on your deployment, for instance: https://sifflet-backend.mycompany.com
  • A Sifflet Access Token

Installation

Open a terminal and verify you have installed Python correctly via python -V. Ensure you have v3.7 or greater.

Install sifflet CLI

pip install sifflet

Confirm the installation with the following command

$ sifflet --version
sifflet, version x.x.x

Upgrade

Upgrade your existing Sifflet CLI installation using

pip install sifflet --upgrade

Configuration

Before using the Sifflet CLI, you need to set your tenant and credentials. You can do it in several ways:

  • Sifflet command line sifflet configure (which will persists configuration in a file)
  • Or with environment variables

You will need in both cases the following information:

  • <access_token>: you can find more information on how to generate it here
  • One of these two parameters is required, depending on your type of Sifflet deployment:
    • SaaS deployments: Your Sifflet <tenant_name> from the Sifflet URL https://<tenant_name>.siffletdata.com. For example, if you access to Sifflet UI with https://mycompany.siffletdata.com, the tenant name would be mycompany.
    • Self-hosted deployments: Your Sifflet backend URL, i.e. the full URL to the Sifflet backend on your deployment, including https:// and /api, for instance: https://sifflet.mycompany.com/api

Sifflet configure

You can input the tenant and credentials directly with the sifflet configure command.

  • SaaS deployments:
> sifflet configure --tenant <tenant_name>
Your API access token [None]: <access_token>
  • Self-hosted deployments:
> sifflet configure --backend-url <backend_url>
Your API access token [None]: <access_token>

The use of sifflet configure will persist the configuration in a file located at ~/.sifflet/config.ini
(or in %UserProfile%\.sifflet/config.ini on Windows).

Environment variables

To use environment variables, you can do the following:

  • SaaS deployments:
> export SIFFLET_TENANT=<tenant_name>
> export SIFFLET_TOKEN=<access_token>
  • Self-hosted deployments:
> export SIFFLET_BACKEND_URL=<backend_url>
> export SIFFLET_TOKEN=<access_token>

You can check that setup is done correctly with sifflet status

$ sifflet status

Sifflet version = x.x.x
Tenant = my_tenant
Tenant is up and reachable
Token expiration date = 2024-01-01 00:00:00
Token is valid with scope API
Status = OK

If you encounter any error at this step, please check your tenant and token configurations.

Help

The --help option is available for any command.
For instance:

sifflet --help

Or for a specific command:

sifflet rules list --help.