Command Line Interface
The Command Line Interface, or CLI, (which requires the Windows Enterprise Edition of Extrata) makes it easy for you to use the Windows Task Scheduler to automate the execution of your Extrata tasks. This is more ideal for using Extrata on a server or with software that supports executing shell commands.
To use the Command Line Interface, you need to create a “package” from the project that contains the tasks you want to execute.
The Command Line Interface works with all non-Oauth based APIs.
The reasons why Extrata uses “packages” for command line execution are:
- A package is a fixed snapshot of the project, sources and task from a specific point in time. Accidental edits or deletions won’t break a scheduled task execution.
- A package is portable. You do not need the Knodeo Desktop application on the machine running the CLI, you only need a copy of the CLI executable on that machine.
Creating Project Packages
- To create a package for a project, select a project from the Projects list, and click on the suitcase icon. A pop up will appear.
- The Save To field will have a premade file name in Extrata’s default Save To folder (which is set in the Settings view).
- You can browse to a new path and rename it. The default filename has a timestamp on it. This timestamp is there as a visual reminder of when the package was created, but you can delete it if it is not useful to you.
- Make sure the Include Secrets checkbox has a check in it. The CLI needs the passwords/secrets to operate properly. If the secret is a file (for example Google Analytics), the path to the file in the source must be the same on the machine that will be running the task (if different).
- Enter a password in the Password and Password Confirmation fields. This password is required to run the task in the CLI, and also prevents unauthorized viewing of the contents of the package.
-z --zipfile -- required (except when using the version flag) - path to the package file -p --password -- required (except when using the version flag) - password of the package file -t --task-id -- required (except when using the version flag) - task id for the task to be executed -l --logfile -- optional -- Writes an execution log (text) to the path specified -o --override -- optional -- Writes the output file (xlsx/csv/json) to a location different from the one specified in the task -v --version -- will identify the version and build of the extrata_cli.exe
Before you can try the examples, you need the following:
- In the command prompt/terminal, you have navigated to the the directory containing the CLI executable (extrata_cli.exe)
- You have created a project package and know its full path
- You have saved the secrets into the project package
- You know the password to the project package
- You know the task id for the task you want to run. You can get this from Extrata Desktop by selecting a project and clicking on a task in the task list. On the resulting screen, the Task ID is underneath the Task Name. A Task ID looks something like this: 1c91e714-af6c-496a-a6cf-0cf0e2513cd9
To find out the version and build of the CLI executable
To run a task
extrata_cli -z “c:\my_exported.zip” -p substitute_package_password -t 1c91e714-af6c-496a-a6cf-0cf0e2513cd9
To run a task and output a log file (text)
extrata_cli -z “c:\my_exported.zip” -p substitute_package_password -t 1c91e714-af6c-496a-a6cf-0cf0e2513cd9 -l “c:\mylog.log”
To run a task and save the output file to a different location
extrata_cli -z “c:\my_exported.zip” -p substitute_package_password -t 1c91e714-af6c-496a-a6cf-0cf0e2513cd9 -o “c:\my_alternate_output_file.xlsx”