Skip to main content

Intro

The Domo CLI (command line interface) tool allows you to perform many data management functions, such as uploading massive DataSets, renaming cards, managing users and groups, and exporting DataSets using text-based commands. Other available functions include importing/exporting from AWS S3 and DataFusion helpers. By automatically breaking large files into smaller parts, you can upload CSV or gzipped CSV files to your Domo instance more efficiently.
Important: The tool requires Java 7 or later.
Screenshot 2023-08-01 at 2.34.21 PM.png

This article describes using the Domo CLI tool in the following topics:

Install and Launch the CLI Tool

To use the Domo CLI tool, download and install it onto your own machine by following the instructions below.
  1. In the navigation header, select More > Admin Settings.
  2. In the More menu, select Tool Downloads.
  3. Locate the Domo CLI tool and select Try the Domo CLI. The utility file downloads to your machine.
  4. Open a terminal application (Terminal on macOS or PowerShell on Windows).
  5. Run the CLI binary file using Java: java -jar domoUtil.jar
    Tip: If using a Windows machine, place the.jar file into a folder such as C:\domo\java. Then, you can launch the CLI Tool by using the following command line: java -jar C:\domo\java\domoUtil.jar

View Available Commands

To view a list of available commands, enter help . Enter help [command name] to view specific flags and parameters for that command.

Deprecated Commands

Some commands that may be listed as available in your version of the tool have been deprecated since you downloaded it. See the list of deprecated commands below.
backup
backup-card
convert-sql
move-page
set-dataset-retention-window
restore card

Command Use Cases

This section describes some command use cases and provides needed or helpful information for using the command. You can scroll through or navigate to them from the following list:

Connect to a Domo Instance

To connect to a Domo instance, run the connect command and enter the following parameters:
-u, —username <USERNAME> Domo login username
-p, —password <PASSWORD> Domo login password
-s, —server <SERVERNAME> Domo server
-pp, —proxypassword <proxypassword> Proxy password
-ps, —proxyserver <proxyserver> Proxy server
-pt, —proxyport <proxyport> Proxy port
-pu, —proxyuser <proxyuser> Proxy user
-t, —token <TOKEN> Token
Example connect -u jim.smith@xyzcompany.com -p abc123 -s xyzcompany.domo.com connect -s xyzcompany.domo.com -t mffde8e727f825ae23e1117070f0ad67cfeb40c607dddd

Disconnect From a Domo Instance

To disconnect from a Domo instance, run the disconnect command without using any parameters.

Create a New DataSet

Follow these steps to create a new DataSet using the CLI Tool:
  1. Create a Domo access token. For more information on how to create and manage access tokens, see Manage Access Tokens.
  2. Obtain the schema file in JSON format of the DataSet you want to upload to Domo by running the derive-schema command.
    Note: To derive the schema from an existing CSV file, use the following command, replacing ”filename.csv’ with your file name. derive-schema -d 'C:\directory\[filename.csv]' -s 'C:\directory\schemafile.json'
  3. Perform a pre-check on the data by generating a clean, true CSV with a small number of rows. Obtain the schema file and run the create-dataset command to validate the upload. You may then delete that DataSet from Domo at your discretion.
    Tip: You will need to place double quotes (”) around any commas in your CSV that you want to escape, otherwise the CLI Tool will use the comma as a delimiter.
  4. If the command is successful, you are presented with the DataSet ID.
  5. When the pre-check is successful, run the create-dataset command using the full file’s schema file.

Delete a DataSet

To delete a DataSet in Domo, use the delete-dataset command, replacing [dataset id] with the ID of the DataSet you want to delete. delete-dataset -id [dataset id] You can get a list of DataSet ID’s by using the list-dataset command.

Upload Data to a DataSet

To upload data to a DataSet after it has been created, use the upload-dataset command, replacing [dataset id] with the ID of the DataSet you want to update.
Important: By default, when updating a DataSet, the entire existing DataSet is replaced with the new upload unless you use the append parameter.
Parameters available for the upload-dataset command are:
-a, —append Append to existing data.
-c, —compressed Data file(s) are gzipped.
-d, —dir <DIRECTORY> Data (CSV) directory.
-f, —data <FILENAME> Data (CSV) file.
-h, —headers Data file has a header row.
-i, —id <ID> DataSet ID.
-p, —partition <arg> Partition tag.
-t, —temp-dir <TEMP> Temp path to use.
Examples
upload-dataset -id [dataset id] -data "c:\directory\datafile.csv"

upload-dataset -i <dataset_id> -f <filename>

upload-dataset -i <dataset_id> -f <filename> -a

upload-dataset -i <dataset_id> -f <filename> -a -p <partition_name>

upload-dataset -i <dataset_id> -d <directory_name>

Upload Data from a Database via JDBC

Ensure the JDBC driver JAR file is in the current working directory. For example, if your domoUtil.jar is in ~/bin, but you are starting the utility from ~, your driver file needs to be in ~. Example
upload-jdbc
  --dataset example_jdbc_upload
  --jdbcConnection jdbc:mysql://localhost:3306
  --jar mysql-connector-java-8.0.18.jar
  --query "select * from example;"
  --jdbcUser root
  --jdbcPassword password
  --jdbcDriver com.mysql.cj.jdbc.Driver

Create a User

Create a user using the CLI Tool by specifying an email, whether or not to send an email invitation, full name, and their access rights role. Currently, you can create users with the following access rights: Admin, Privileged, Editor, Particpant, and Social. create-user -n 'James Smith' -r Editor -i true -e jim.smith@xyzcompany.com

Query (Export) Data

Important: By default, queries return a maximum of one million rows. You can specify a higher limit in your query but you may experience timeouts if the result is too large. For full exports, use the export-data command.
The query-data command exports the data from a specified DataSet ID to a CSV file. Either the -q or -qf parameters must be used with this command.
Note: The exported file respects any Personalized Data Permissions (PDP) that are set for the specified DataSet.
The parameters available for this command are:
-i, —id <ID> DataSet ID
-q, —query <QUERY> Query file in JSON format
-qf, —queryfile <QUERYFILE> Query filename
-xf, —exportfile <EXPORTNAME> Export filename
Example
query-data -i [dataset id] -qf [query file in JSON format] -xf [filename]

Generate Card Image

The generate-card-image command generates a PNG image of the specified card ID. generate-card-image -i <card id> -f <file name>

Export Card Data

The download-card-data command downloads data from the specified card ID. download-card-data -i <card id> -f <output_csv_file>

Move a Dashboard

The move-page command allows you to move a page up in the hierarchy as a top level page or down in the hierarchy to a subpage. The parameters available for this command are:
-a, —move type Choose promote or demote depending on where the page should be moved.
-c, —page Page ID
-p, —newparentpage Parent page ID if demoting a page.

Demote a Dashboard

move-page -a demote -c 1234567 -p 7654321

Promote a Dashboard

move-page -a promote -c 1234567

Move Data

The move-data command allows you to move data from one existing DataSet to another existing DataSet. The parameters available for this command are:
-a, —append Append to existing data
-d, —destination <destination> Destination DataSet
-s, —source <source> Source DataSet
Example move-data -a -s [DataSet ID of where the data is coming from] -d [DataSet ID of where the data will be moved to]
Note: To move data using a replace method, remove the -a parameter from the command line.

List DataSets

The list-dataset command will list all of the DataSets based on owner, a search term, or a specific DataSet ID. The parameters available for this command are:
-i, —id <ID> DataSet ID
-n, —name-like <NAME_PATTERN> Name filter
-o, —owner-id <TYPE> DataSet Owner ID

Note : Use ‘me’ instead of a DataSet Owner ID to use the currently authenticated user.

Example
list-dataset -o me -name-like "sales"

list-dataset -name-like "marketing"

Search Domo

The search-domo command searches and exports a list from Domo by entity type and search term. The parameters available for this command are:
-e, —entities <ENTITIES> Entity type. Valid entities include app, buzz, buzz_channel, connector, dataflow, dataset, dojo_message, feature, knowledge_base, project, task, page, card, user, and group.
-f, —filename <NAME> Filename to export information.
-l, —limit <LIMIT> Result limit.
-o, —offset <OFFSET> Result offset.
-t, —term <TERM> Search term.
Example search-domo -e "card,dataset" -t "sales"

Who am I?

The whoami command returns the username and user ID of the individual that is currently logged in. There are no parameters for this command.
> whoami

John Smith (userid: 123456789)

End a Session

To end your CLI session, run both the disconnect and quit commands. There are no parameters for these commands.

Scripting

While you can type the commands shown above in the command prompt, you can also create a text file with the commands and execute it as a script file. Example script file connect -t [access token id] -s xyzcompany.domo.com upload-dataset -id [dataset id] -data "c:\directory\datafile.csv" -append quit Example script file execution java -jar domoUtil-2.31.jar -script c:\directory\<uploadfile.script>
Tip: Update <uploadfile.script> in the above example to your own script file name.

Common Issues

If you have Java 17 or later installed, you must add the following JVM parameter to the command that runs the CLI:
--add-opens java.base/java.nio=ALL-UNNAMED
Example:
java --add-opens java.base/java.nio=ALL-UNNAMED -jar domoUtil.jar