Quick Start with CLI

Count API CLI is a standalone tool which enables you to count up/down, get counter information or list history of the counter.


It does not require authentication or login.
CLI command to counter things

Usage:
  counter [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  counts      Fetches counts of counter
  down        Count down for given name
  get         Fetches counter information
  help        Help about any command
  set         Sets counter
  up          Count up for given name
  version     Print the version/build number

Flags:
  -h, --help   help for counter

Use "counter [command] --help" for more information about a command.

Count Up

You can count up with given name. The name of the counter is unique. Do not forget that anyone with same name can count up or down.

❯ counter up --name MyCounter01 --namespace example.com               
{
        "id": 12,
        "name": "MyCounter01",
        "count": 1,
        "created_at": "2021-03-28T21:19:09.450461117Z",
        "updated_at": "2021-03-28T21:19:09.466029457Z"
}

Count Down

❯ counter down --name MyCounter01 --namespace example.com
{
    "id": 12,
    "name": "MyCounter01",
    "count": 0,
    "created_at": "2021-03-28T21:19:09.450461117Z",
    "updated_at": "2021-03-28T21:19:09.466029457Z"
}

Set Count

You can set your counter to with set function.

❯ counter set --name MyCounter01 --namespace example.com --count 10
{
    "id": 12,
    "name": "MyCounter01",
    "count": 10,
    "created_at": "2021-03-28T21:19:09.450461117Z",
    "updated_at": "2021-03-28T21:19:09.466029457Z"
}

Get Counter

After counting up/down, you can get the final status of your counter with get function.

❯ counter get --name MyCounter01 --namespace example.com
{
    "id": 12,
    "name": "MyCounter01",
    "count": 0,
    "created_at": "2021-03-28T21:19:09.450461117Z",
    "updated_at": "2021-03-28T21:19:09.466029457Z"
}