Developer Documentation

Development for the toolbelt is aimed to be accessible for everyone! This set of articles contains documentation on how to develop new commands for the toolbelt using argus-cli and argus-api.

Getting started

Use the following links to get more extensive help on developing for the toolbelt!

Example command

The following is a simple command for printing case-numbers when searching a case :

from argus_cli.plugin import register_command, run  # Function for registering a command to the cli
from argus_cli.utils import formatting  # Common helper for creating nice outputs
from import advanced_case_search  # The case search endpoint

from argus_plugins import argus_cli_module
from argus_plugins.cases.utils import get_customer_id

# Register the command
# The command with arguments for title and customer (which automatically translates a customer name to it's ID)
def search(title: str, customer: get_customer_id):
    """Search for a case

    :param title: Title to search for
    :param customer: Customer to base the search on
    # Get cases based on a customer and keyword
    cases = advanced_case_search(
        keywords = [title]
    )["data"]  # We only care about the data the endpoint returned. Not the metadata about the response.

    # Prints the ID and subject in CSV format
    print(formatting.csv(cases, headers=["id", "subject"]))

# Allow for running by simply executing the file
if __name__ == "__main__":
./ Email mnemonic
23,Suspect Email
42,Weird Email
./ --help
 usage: [-h] [--apikey APIKEY] [--debug]
                           [--environment ENVIRONMENT]
                           title customer

 positional arguments:
   title                 Title to search for
   customer              Customer to base the search on

 optional arguments:
   -h, --help            show this help message and exit
   --apikey APIKEY
   --environment ENVIRONMENT