Differences between API and CLI usage#
While the functionality between API and CLI is mostly the same, there are some difference in their usage that should be taken into account.
Commands in the CLI are constructed by specifying a topic and an action, with a
hyphen between them:
host-del. When accessing through
the API, the topic and the action are divided by an underscore instead:
host_del. All available commands can be found below
api.Command after the API is initialized.
When managing plugins through the CLI, their parameters have different names
than the API, where names are the same as the LDAP attributes. For example,
user-add takes the
first parameter in the CLI. However, this is named
givenname when calling
user_add through the Python API.
When passing dates through the CLI, multiple date string formats are available:
When using the API, apart from these formats, the Python built-in
can be used as well.
FreeIPA provides multiple tools that are mainly useful for CLI usage:
console: starts an interactive Python console with an IPA API object already initialized.
help: shows help about topics and commands, including examples for the CLI.
show-mappings: shows the mapping between CLI parameter names and LDAP attributes.