CLI
6 minute read
The API Builder CLI allows you to create projects (both integrations and plugins), and download connectors from the Amplify Unified Catalog. In order to install the API Builder CLI, you must first install the Axway CLI.
Installing the API Builder CLI
axway pm install @axway/amplify-api-builder-cli
Refer to the Axway CLI documentation for additional details about the axway
command.
Note
For users who downloaded the API Builder CLI directly vianpm
, we recommend that you re-install the CLI using the Axway CLI to take advantage of the full range of features this CLI offers. Your existing projects will continue to work as before.
Updating the API Builder CLI
We recommend that you update the Axway CLI as it can contain important fixes and security updates. To update the Axway CLI run the following command:
[sudo] npm i -g axway
We recommend always keeping the API Builder CLI up-to-date. To update the API Builder CLI (and other Axway CLI plugins) run the following command:
axway pm update
Note
If you are currently using theamplify
command, the Amplify CLI has been deprecated and replaced with the Axway CLI. You can run the commands on this page to re-install the API Builder CLI with the axway
command.
Logging into the Amplify platform
Some of the options below require you to log into the Amplify platform. You can do that with the following command:
axway auth login
Commands
init
This command creates a new integration project. The result is a directory containing a skeleton project with sample APIs and flows that can be removed. All npm
dependencies are installed along with the project; this can be optionally disabled with a switch. Once the project is created, you are directed to change to the created directory to launch the project. The logfile will tell you the URL you need to use in your browser to access the graphical console. Normally, this will be http://localhost:8080/console.
This is the command to create a new project named “marketing_api”
axway builder init marketing_api
Then, install the project’s dependencies and start the API Builder project.
cd myproject
npm start
Once your project is running, point your browser to http://localhost:8080/console
to access the API Builder user interface (UI) console.
--get-catalog
If logged into the Amplify platform (see above), this command will present you with APIs from the Unified Catalog available to you for use in your flows. This is an interactive command that allows you to choose which APIs for which you would like to download specifications. If you do not want to run this command when creating your project, you can always run the get-catalog command (see below) at any time in your project. Once run successfully, you will see new flow-nodes representing your chosen APIs in the flow editor.
The examples below imagines a project named “marketing_api”.
axway builder init --get-catalog marketing_api
If you want to narrow down the list of APIs, you can filter the results on the API name.
axway builder init --get-catalog --filter="Marketo" marketing_api
--example
You can use the CLI to generate example projects that showcase a specific part of the product. To see the list of available examples:
axway builder init --example
You can navigate up and down the list of available examples using the arrow keys. To select an example press Enter
.
Selecting an example will create the project and install its dependencies. After the installation is completed you will receive the location and instructions how to start the project:
Successfully created: api-builder-example-greet. To run:
cd api-builder-example-greet
npm start
--no-install
This command prevents the installation of dependent node_modules when the project is initialized. Using the same example project name as above.
axway builder init --no-install marketing_api
Once you want to install dependencies, you can change to your project directory and run this command:
npm install
get-catalog
This command has the same effect as the --get-catalog
command described in the “init” section. It must be run while inside an API Builder project directory. If logged into the Amplify platform (see above), you will be provided with a catalog of APIs available to you for use in your flows. This is an interactive command that allows you to choose which APIs for which you would like to download specifications. Once run successfully, you will see new flow-nodes representing your chosen APIs in the flow editor.
axway builder get-catalog
--filter
If you want to narrow down the list of APIs, you can filter the results on the API name.
axway builder get-catalog --filter="Marketo"
plugin init
You use this command when you want to create a new plugin for use in your API Builder projects. There are two types of plugins:
-
Standard
This is the default type of plugin. This type of plugin results in a flow-node that implements whatever functionality you choose (and can implement in JavaScript).
-
OAS
A “Custom OpenAPI” type plugin template allows you to package and share plugins containing flow-nodes generated by dropping OpenAPI files into your plugin’s
openapi
directory. This allows you to use the plugin concept to manage the life-cycle of access to this API vianpm
, and the added flexibility of being able to extend how this API is accessed from an API Builder flow.
The following command will create a new plugin project:
axway builder plugin init api-builder-plugin-legacy-connector
All API Builder plugins must being “api-builder-plugin”, if you entered instead:
axway builder plugin init legacy-connector`
Then a directory names api-builder-plugin-legacy-connector would still be created.
--no-install
This command prevents the installation of dependent node_modules when the plugin is initialized. (Using the same example plugin name as above.)
axway builder plugin init --no-install legacy-connector
--type
This option allows you to specify the type of plugin you would like to create (see above). The options are “standard” and “oas”. If neither is specified, then “standard” is assumed. You can specify “standard” as follows:
axway builder plugin init --type=standard
You can also create a custom OpenAPI plugin template. A “Custom OpenAPI” type plugin template allows you to package and share plugins containing flow-nodes generated by dropping OpenAPI files into your plugin’s openapi
directory.
To create an OpenAPI plugin template, you can use this command (using the same example plugin name as above):
axway builder plugin init --type=oas legacy-connector
API Builder CLI (npm)
While we recommend to use the API Builder CLI as part of the Axway CLI, a secondary CLI is available for install on npm which does not depend on the Axway CLI. This has all the same functionality, however the commands and install mechanism are slightly different.
Installation and update
[sudo] npm install -g @axway/api-builder
Usage
All commands are as documented above. The only difference is that instead of axway builder
, the command is api-builder
. For example to initialise a new project, the following command is used:
api-builder init marketing_api