Overview of the command-line tool
The IBM® API Connect developer toolkit provides commands for cloud administration and API development and management.
Command syntax
apic command:sub-command [argument] [options]
where - command is the command, usually the thing on which you are acting (for example, product, app, API, Catalogs, and so on).
- sub-command is the action to perform.
- argument is the argument, where applicable (for
example,
catalog
). - options are any number of command-line options, which have the form
--option [value]
. Options also have a short form with a single dash instead of a double dash.
apic apps:publish --server mgmnthost.com
.apic products:publish
is equivalent toapic publish
.apic products:list
is equivalent toapic products
.
create
command has a slightly different
syntax:apic create:type [options]
-h
or --help
option to view command help.Viewing command line tool help
Display general command-line help information by
entering the following command: apic --help
or apic -h
. Display
help information for a specific apic
command by entering the following command:
apic command_name --help
or apic
command_name -h
.
Viewing version information
Display the version of the
command-line tool by entering the command: apic --version
.
Using configuration variables
The configuration variables for OpenAPI projects are always global. The values of global configuration variables are stored in the user-home-dir/.apiconnect/config file, where user-home-dir is the user's home directory.
Use the following commands to work with configuration variables:
apic config:get varname
- Get a configuration variable. Useapic config
to display the values of all local configuration variables orapic config -g
to display the values of all global configuration variables.apic config:set varname
- Set or update the specified configuration variable.apic config:delete varname
- Delete the specified configuration variable.apic config:clear
- Delete all configuration variables.
You set configuration property values by using the apic config:set command. By
setting configuration properties (for example catalog
and app
),
you do not need to supply values for these options when you enter a command.
apic properties
commands to work with configuration
properties:apic properties:clear
- Clear the configuration properties.apic properties:create
- Augment the configuration properties with additional name/value pairs.apic properties:delete
- Delete the configuration property.apic properties:get
- Get the configuration property.apic properties:list
- List the configuration properties.apic properties:update
- Update the configuration property.
If you have an environment variable of the same name as a CLI configuration property then, by default, its value will override the value of the corresponding CLI configuration property for any CLI command at that scope.
SPACE
then, by
default, that value will be assumed for the value of the --space
parameter in the
following command, regardless of any space
configuration property
setting:apic products:publish my_product.yaml --scope space
To prevent environment variables overriding CLI configuration properties, define an environment
variable called APIC_LOAD_FROM_ENV
, set to the value false
.
The following table describes the configuration variables:
Variable name | Description | Use instead of (or override with) these flags... |
---|---|---|
catalog | Default Catalog name for all commands that manage aspects of a Catalog. The Catalog value
can be specified as either:
Note: The Catalog name
apic-dev is reserved for local testing. |
|
cloud | Default management server host name for cloud administration commands. Form:
mgmt-server/api/ . |
--server |
consumer | Default URI of an API consumer. Form:
mgmt-server/api/consumer-orgs/org-name/catalog-name/consumer-org-name ,
where mgmt-server is the management server, org-name is the
organization name, catalog-name is the Catalog name, and
consumer-org-name is the consumer organization name. |
-–server, -–organization, -–catalog, -–consumer |
mode | The default value of the --mode parameter for CLI commands. Set the value to
apim or consumer depending on whether you want to run commands on
a provider organization or a consumer organization. If you do not set this variable, and do not
supply a --mode parameter on a command, the value apim is
assumed. |
--mode |
org | Default org name for all commands that manage organizations. Form:
The org value can be specified as either:
|
|
space | Default Space URI for all
commands that manage aspects of a Space. Form:
You can append the port number to the server name if it is not the default value of 443. |
--server, --organization, --catalog, --space |
apic config:set name=value
where
name is the name of the configuration property and value the
value to assign to it. For example:
apic config:set catalog=sandbox
Scripting commands
apic
commands In a shell script.
Since the apic
tool first requires you to interactively accept the license, you
must first use the following command:apic --accept-license
Once you do that,
your scripts can run non-interactively.apic --live-help
Setting the language
You can configure the language for the CLI command outputs by using the --lang
flag. This flag allows the developer toolkit to provide command
outputs in the specified language. The following table contains the supported languages:
Language value | Language |
---|---|
en-us | English (US) |
cs | Czech |
de | German |
es | Spanish |
fr | French |
it | Italian |
ja | Japanese |
ko | Korean |
nl | Dutch |
pl | Polish |
pt-br | Portuguese (Brazil) |
ru | Russian |
tr | Turkish |
zh-cn | Chinese (Simplified) |
zh-tw | Chinese (Traditional) |
apic --lang fr
apic config get invalid
Error: invalid n'est pas une variable de configuration valide
apic --lang invalid
Error: Value invalid is not valid for lang. Valid values are: en-us, cs, de, es, fr, it, ja, ko, nl, pl, pt-br, ru, tr, zh-cn, zh-tw