Overview of the command-line tool

The developer toolkit provides commands for working with APIs, Products, and applications, and for launching the API Designer graphical tool.

Command syntax

In general, commands have the following 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.
For example, apic apps:publish --server mgmnthost.com.

For some commands, either the command or sub-command portion is optional. For example:

  • apic products:publish is equivalent to apic publish.
  • apic products:list is equivalent to apic products.
Note: The create command has a slightly different syntax:
apic create --type sub-command [options]
Use the -h or --help option to view command help. Some of the commands in the following tables are annotated with Stability: prototype, which indicates that IBM® is in the process of collecting customer feedback on the commands and you should not use them in production scripts.

Viewing version information

Display the version of the command-line tool by entering the command: apic --version or apic -v. Display extended version information, including the versions of all the command-line tool plug-in modules, by entering the command: apic --ext-version.

Launching the API Designer

The API Designer graphical tool provides most of the capabilities of the command-line tool but with a visual interface.

To launch the API Designer, enter the command apic edit.

Creating and validating artifacts

Table 1. Summary of general-purpose apic commands
Command Description Sub-commands
apic config List and manage configuration variables. For more information, see Using configuration variables.

With no sub-command, lists values of defined configuration variables.

  • get - Get a configuration variable.
  • list - List configuration variables (default).
  • set - Set configuration variables.
  • delete - Delete a configuration variable.
  • clear - Delete all configuration variables
apic create Create project artifacts.
  • --type api - Create an API.
  • --type api --wsdl filename - Create a SOAP API from a WSDL definition file, or a .zip file that contains the WSDL definition files for a service. The name and version of the generated API are obtained from the WSDL file.
  • --type product - Create a Product.
  • --type model - Create a LoopBack® model.
  • --type datasource - Create a LoopBack data source.
[V5.0.2 or later]Note: You can create an API or Product from an OpenAPI (Swagger 2.0) template file by using the --template template-name option.
apic edit Run the API Designer and open in default web browser. None
[V5.0.7 or later]apic extensions Manage OpenAPI (Swagger 2.0) extensions in a catalog.

With no sub-command, lists the extensions in the production catalog.

Stability: prototype

  • clone - Pull all extensions from a catalog.
  • delete - Delete an extension in a catalog.
  • get - Get information on an extension in a catalog.
  • list - List all extensions published to a catalog (default).
  • publish - Publish an extension to a catalog.
  • pull - Pull an extension from a catalog.
apic loopback Create LoopBack project and project artifacts.

With no sub-command, creates a new LoopBack project.

All of these commands are Stability: prototype, except for loopback:app.

  • acl - Add access control list specification.
  • app - Create a new LoopBack project (default).
  • boot-script - Add boot script.
  • export-api-def - Generate OpenAPI (Swagger 2.0) definitions from models.
  • middleware - Add middleware function.
  • property - Add property to existing model.
  • refresh - Update Product and API definition from a model.
  • relation - Add relation between models.
  • remote-method - Add remote method
  • swagger - Generate LoopBack project from an OpenAPI (Swagger 2.0) definition.
[V5.0.7 and earlier]apic microgateway Create Micro Gateway applications.
Important: IBM API Connect Micro Gateway is deprecated in IBM API Connect Version 5.0.8 in favor of DataPower® Gateway. From 1 April 2020, Micro Gateway, and associated toolkit CLI commands, will no longer be supported. Existing users can migrate their API definitions to IBM DataPower Gateways. For information on supported API policies, see Built-in policies.
None
apic validate Validate API or Product definition YAML file. None

Managing and testing applications

Table 2. Summary of apic commands to manage and test applications locally
Command Description Sub-commands
apic logs Display server logs continuously to console. None
[V5.0.7 and earlier]apic props List and manage service properties for a LoopBack application running locally.

With no sub-command, lists values of defined service properties.

  • get - Get a property value.
  • list - List all property values (default).
  • set - Set or update property values.
  • delete - Delete a service property.
  • clear - Delete all service properties.
[V5.0.7 and earlier]apic services List and manage services.

With no sub-command, lists all services that are currently executing.

  • list - List all services currently executing (default)
  • start - Start a service.
  • stop - Stop a service.
  • logs - Display logs to console.
  • get - Get information about a service.
[V5.0.7 and earlier]apic start If run in LoopBack project directory, start the LoopBack application; otherwise, start the Micro Gateway.
Important: IBM API Connect Micro Gateway is deprecated in IBM API Connect Version 5.0.8 in favor of DataPower Gateway. From 1 April 2020, Micro Gateway, and associated toolkit CLI commands, will no longer be supported. Existing users can migrate their API definitions to IBM DataPower Gateways. For information on supported API policies, see Built-in policies.
None
[V5.0.7 and earlier]apic stop Stop the specified service or all services. None
[V5.0.6 or later]apic explore Opens the API Explore tool.
Shows the operations, definitions, and documentation for all of the APIs that are contained in the project directory. To specify a particular API, include the name of the API in the command, for example:
apic explore apiname.yaml
Option:
  • -e, --external
Opens the Explore tool on 0.0.0.0 instead of the default 127.0.0.1. This option binds the server to all IP addresses on the machine, and makes the tool accessible on the wider network.

Managing artifacts and publishing to the cloud

Table 3. Summary of apic commands to manage APIs, apps, Products, and Catalogs, and publish them to the cloud
Command Description Sub-commands
apic apps List, manage, or publish applications.

Default sub-command is list.

  • get - Get information about an application.
  • build - Build an application.
  • list - List provider apps contained in organizations of which the currently-authenticated user is a member (default sub-command).
  • publish - Publish an application to a provider app.
  • set - Update an application.
apic apis List and manage APIs in a Catalog or Space.Stability: prototype

Default sub-command is list.

  • clone - Pull all APIs from a Catalog or Space - Build an application.
  • get - Get information on an API in a Catalog or Space.

    [V5.0.7 or later]The output separately lists the production and development endpoints at which an application can call the API. For more information, see Managing the application lifecycle.

  • list - List APIs in a Catalog or Space (default sub-command).
  • pull - Pull an API from a Catalog or Space.
  • set - Update an API in a Catalog or Space.
apic catalogs List and manage Catalogs.
  • catalogs:create Create a Catalog in an organization
  • catalogs:delete Delete a Catalog in an organization
  • catalogs:get Get information on a Catalog in an organization
  • catalogs:list - List Catalogs contained in organizations of which the currently-authenticated user is a member (default sub-command).
  • [V5.0.8 or later]catalogs:transfer - Beginning with Version 5.0.8.4: Transfers the ownership of a Catalog to another user.
[V5.0.4 or later]apic devapps List and get information about consumer applications.

Default sub-command is list.

  • get - Get information about a consumer application.
  • list - List consumer apps in an organization and a Catalog.
apic drafts List and manage APIs and Products in drafts.

Default sub-command is list.

  • clear - Delete all API and Product definitions in drafts.
  • clone - Pull all API and Product definitions from drafts.
  • delete - Delete an API or Product definition from drafts.
  • list - List APIs and Products in drafts (default sub-command).
  • get - Get information on an API or Product definition in drafts.
  • publish - Stage and publish a Product and its referenced APIs in drafts to a Catalog.
  • pull - Pull API or Product definitions from drafts.
  • push - Push local API or product definitions to drafts.
apic login Log in to API Manager. None. Specify server and credentials with the required flags:
  • -u, --username user_name
  • -p, --password password
  • -s, --server mgmt_server.
[V5.0.7 or later]You can append the port number to the server name if it is not the default value of 443.
apic logout Log out from API Manager. None. Specify server with the required flag:
  • -s, --server mgmt_server.

[V5.0.7 or later]You can append the port number to the server name if it is not the default value of 443.

[V5.0.5 or later]apic members List members in an organization.

Stability: prototype

None
[V5.0.4 or later]apic orgs:get Display information on a consumer or provider organization. Use --type provider|consumer to specify either provider or consumer organization.
  • get - Display information on a consumer or provider organization.
apic organizations

[V5.0.4 or later]apic orgs

List and get information about organizations.

Default sub-command is list.

Note: The organizations command available in early releases is deprecated in favor of orgs.
  • get - Get information on a provider organization.
  • list - List organizations of which the currently-authenticated user is a member. On IBM Cloud, lists only organizations where the API Management tile is provisioned and added.
apic policies List and manage policies in a Catalog.

Default sub-command is list.

  • clone - Pull all policies from a Catalog.
  • delete - Delete a policy from a Catalog.
  • get - Get information on a policy in a Catalog.
  • list - List policies in a Catalog (default sub-command).
  • publish - Publish a policy to a Catalog.
  • pull - Pull a policy from a Catalog.
apic publish Publish a Product and its referenced APIs to a Catalog.

[V5.0.5 or later]If Spaces are enabled for a Catalog, Products can be published only to a Space within that Catalog. To publish to a Space, the --scope space option must be included in the publish command.

None.

This is an alias for apic products:publish.

apic products List and manage Products in a Catalog.

Default sub-command is list.

  • clear - Clear all Products in a Catalog. Stability: prototype
  • clone - Pull all Product definitions from a Catalog. Stability: prototype
  • delete - Delete a Product in a Catalog.
  • get - Get information on a Product in a Catalog.
  • list - List Products in a Catalog (default sub-command).
  • publish - Stage and publish Product and referenced APIs to a Catalog.
  • pull - Pull a Product from a Catalog.
  • [V5.0.4 or later]replace - Replace a Product in a Catalog with another Product . Stability: prototype
  • set - Update a Product in a Catalog.
  • [V5.0.4 or later]set-migration-target - Set migration target of a Product in a Catalog with another Product. Stability: prototype
  • [V5.0.4 or later]supersede - Supersede a Product in a Catalog with another Product. Stability: prototype
[V5.0.5 or later]apic spaces List and manage Spaces contained in a Catalog.

Default sub-command is list.

  • spaces:create Create a Space in a Catalog
  • spaces:delete Delete a Space in a Catalog.
  • spaces:get Get information on a Space in a Catalog.
  • spaces:list List Spaces contained in a Catalog (default sub-command).
  • spaces:set Set information on a Space in a Catalog.
[V5.0.5 or later]apic subscriptions List and manage subscriptions in a Product or a Catalog.

Default sub-command is list.

  • subscriptions:get - Get information on a subscription in an app.
  • subscriptions:list List Spaces contained in a Catalog (default sub-command). Stability: prototype