@axway/amplify-api-builder-cli
An installable API Builder CLI package for the Axway CLI.
Installation
Assuming you are familiar with Node.js and npm, you should first install the Axway CLI, which will give you connectivity to the Amplify Platform. Note that you must first have an account on https://platform.axway.com, and be provisioned in Amplify Central:
$ [sudo] npm install -g axway
Use the Amplify package manager command to install the API Builder command line:
$ axway pm install @axway/amplify-api-builder-cli
Scaffolding a new project
You can use the CLI to generate a new project. The CLI will create a new directory called ./myproject
and initialize the new project and automatically install its dependencies.
$ axway builder init myproject
$ cd myproject
$ npm start
Once it is running, you can open your browser to http://localhost:8080/console
to access the UI.
Scaffolding an example project
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
Scaffolding a new project with Amplify Unified Catalog
You can create a new project and initialize it with proxy services available from Amplify Central. Log in to the Amplify Platform production server using the following command:
$ axway auth login
Then, initialize a new API Builder project and specify the --get-catalog
option. This will use the current Amplify user session to download the proxy services available from Amplify Central. The command will create the project, download the proxy services, and execute an npm install
in the myproject
directory.
$ axway builder init --get-catalog myproject
$ cd myproject
Running your API Builder service
Running an API Builder service will launch the runtime and the UI, which can be used to make changes to your service. By default, the service will bind to http://localhost:8080
. If you wish to change this, see the following section on Providing environment-specific configuration.
$ npm start
Then, open a browser to: http://localhost:8080/console
Scaffolding a new flow-node plugin
You can use the CLI to generate a new flow-node plugin project to create custom flow-nodes that can be shared and used in the API Builder Flow editor.
$ axway builder plugin init myplugin
The CLI will create your plugin in a new directory called ./api-builder-plugin-myplugin
and will install its dependencies.
Then you can switch to the newly created plugin directory and run the test suite:
$ cd api-builder-plugin-myplugin
$ npm test
Scaffolding a new custom OpenAPI flow-node plugin
You can use the CLI to generate a new flow-node plugin project to create custom flow-nodes that can be shared and used in the API Builder Flow editor.
$ axway builder plugin init --type=oas myplugin
The CLI will create your plugin in a new directory called ./api-builder-plugin-myplugin
and will install its dependencies.
Then you can switch to the newly created plugin directory.
$ cd api-builder-plugin-myplugin
You should copy one or more OpenAPI files that you intend to generate flow-nodes from into the openapi
directory.
Optionally, you can also provide an icon alongside each OpenAPI file which will be displayed in the API Builder UI. The OpenAPI file and icon should have matching file names:
petstore.json
petstore.svg
Now you can run the test suite:
$ npm test
For more information, see Create a plugin from OpenAPI files.
CLI reference
axway builder init [--get-catalog] [--no-install] <dir>
Create an API Builder project.
Options
--get-catalog - Uses an existing authenticated login to access Amplify Central to download the Amplify Unified Catalog for use within API Builder.
--no-install - Does not automatically run npm install
.
Arguments
directory - The project directory to create.
Description
Creates and initializes a new API Builder project in the directory specified by directory
. The command will not run if the directory exists or if the command is run within an existing API Builder project directory.
Example
Initialize a new project directory:
$ axway builder init myproject
Initialize a new project directory and download the Amplify Unified Catalog (requires login with the Axway CLI):
$ axway auth login
$ axway builder init --get-catalog myproject
axway builder get-catalog
Download the Amplify Unified Catalog from Amplify Central into an existing project directory.
Description
A valid Amplify user login is required to use this command. It will connect to Amplify Central and download and install the Amplify Unified Catalog into an existing project directory. You must be in your project directory to execute this command.
Example
Download and install the Amplify Unified Catalog into an existing project (requires login):
$ axway builder get-catalog
axway builder plugin init [--no-install] [--type] <directory>
Create an API Builder plugin.
Options
--no-install - Does not automatically run npm install
.
--type - The type of plugin to initialize. Specify standard
or oas
. Default is standard
.
Arguments
directory - The plugin directory to create.
Description
Creates and initializes a new API Builder plugin project by creating the project in the directory specified by directory
. If directory
is not prefixed with "api-builder-plugin-"
, it will be prefixed for you. The command can be run in an existing API Builder project directory.
Author
Axway support@axway.com https://axway.com
License
This code is proprietary, closed source software licensed to you by Axway. All Rights Reserved. You may not modify Axway’s code without express written permission of Axway. You are licensed to use and distribute your services developed with the use of this software and dependencies, including distributing reasonable and appropriate portions of the Axway code and dependencies. Except as set forth above, this code MUST not be copied or otherwise redistributed without express written permission of Axway. This module is licensed as part of the Axway Platform and governed under the terms of the Axway license agreement (General Conditions) located here: https://support.axway.com/en/auth/general-conditions; EXCEPT THAT IF YOU RECEIVED A FREE SUBSCRIPTION, LICENSE, OR SUPPORT SUBSCRIPTION FOR THIS CODE, NOTWITHSTANDING THE LANGUAGE OF THE GENERAL CONDITIONS, AXWAY HEREBY DISCLAIMS ALL SUPPORT AND MAINTENANCE OBLIGATIONS, AS WELL AS ALL EXPRESS AND IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO IMPLIED INFRINGEMENT WARRANTIES, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, AND YOU ACCEPT THE PRODUCT AS-IS AND WITH ALL FAULTS, SOLELY AT YOUR OWN RISK. Your right to use this software is strictly limited to the term (if any) of the license or subscription originally granted to you.