Midaz CLI
The Midaz CLI (Command Line Interface) is a powerful tool for interacting with the Midaz platform's services and APIs via the command line. It supports operations like creating, listing, editing, and deleting entities such as Ledgers, Organizations, and Divisions, providing users with efficient control over their workflows.
Designed with functionality and simplicity in mind, the CLI is self-documenting. By using the --help
flag, you can instantly access a list of available commands and their usage, ensuring an intuitive user experience.
Color and Type Formatting
Midaz CLI uses an intuitive visual system to enhance readability and support users with varying levels of CLI experience. These conventions include the following:
- Entities and IDs
- The types of entities (Ledger, Organization, and Divisions) are displayed in blue and bold.
- The IDs are displayed in pink and bold.
- HTTP Methods
- POST: Displayed in yellow and bold.
- DELETE: Displayed in red and bold.
- PUT and PATCH: Displayed in blue and bold.
- GET: Displayed in green and bold.
Example
![Figure 1. An example of an Organization created using Midaz CLI.](https://files.readme.io/f05dd85a9b6875cfad632c178c74f1f515a054052cb2188ad513e5a9a7b6e7cf-organization_created.jpg)
Figure 1. An example of an Organization created using Midaz CLI.
Spacing
All text displayed follows single-spacing to ensure a clean presentation.
Iconography
- ✔: Indicates a successful operation.
- ✕: Indicates a failed operation.
Usage Modes
The Midaz CLI supports three primary usage modes:
Single-line Commands
If you want to use single-line commands, you can pass all required parameters directly in the command (figure 2).
![Figure 2. Example of a single-line command.](https://files.readme.io/b0591ae11e7e243c847e2700718ce26f98597b83578793315c656592fd33faf4-single_line.jpg)
Figure 2. Example of a single-line command.
Interactive Mode
In interactive mode, you will complete the request as if it were a form. The required parameters will be requested one at a time (figure 3).
![Figure 3. Example of the interactive mode.](https://files.readme.io/2c65f8dd9054070eab01cf1ad15f768d392fe44f4bd6cce45fa7ab64497d353c-interactive_mode.jpg)
Figure 3. Example of the interactive mode.
Attention
In iteractive mode, only the required fields will be requested. If you want to use the optional fields, use the single-line command.
Help Mode
If you need assistance with any command or subcommand, you can use the --help
or -h
options at the end of the command. This will display information such as a description, examples, and available options for that command (figure 4).
![Figure 4. Example of the help mode.](https://files.readme.io/ff3e1b58caf40bbe08ca972956feaab2ac21366e689848fd8f78f494d210c44b-help_mode.jpg)
Figure 4. Example of the help mode.
Midaz CLI Configuration
If needed, you can use the mdz configure
command to define the following parameters according to the values you use for your operations:
Parameter | Command | Description |
---|---|---|
client-id | --client-id <string> | The unique client identifier used for authentication. |
client-secret | --client-secret <string> | The secret key used to validate the client's identity. |
url-api-auth | --url-api-auth <string> | The URL of the authentication service. |
url-api-ledger | --url-api-ledger <string> | The URL of the service responsible for the ledger. |
Midaz CLI Authentication
To start using Midaz CLI, you must first authenticate. To do so, use the command $ mdz login
. You can log in via browser or terminal.
User Credentials
For more information about the standar user, refer to the Authenticating to Midaz page.
Logging in via browser
If you choose the Log in via browser
option, a window will open using your default browser where you can log in using the credentials (figure 5).
Tips
If you need to perform other actions like resetting the password, use the
Log in via browser
option.
![Figure 5. Default Midaz login page (via browser)](https://files.readme.io/3edb2ba3fcce8fe74c967ace442b7dddbe45b9f122aa8514ec64ff64dda14df8-loggin_browser.jpg)
Figure 5. Default Midaz login page (via browser)
Logging via terminal
If you choose the Log in via terminal
option, you will be prompted for the credentials on the terminal itself (figure 6).
![Figure 6. Example of log in via the terminal.](https://files.readme.io/e430ed9b034b99336ed62bba5f317ae30a3e88a48417372d64e9e6a76959740d-terminal_login.jpg)
Figure 6. Example of logging in via the terminal.
In the terminal, you can only log in using the credentials. If you need to perform additional actions, such as recovering your password or using alternative login methods like a verification code, use the Log in via browser
option.
Updated about 1 month ago