@axway/api-builder
An Axway API Builder command-line utility.
Installation
The preferred way to invoke the API Builder CLI is to use npx
. This ensures you get the latest CLI and API Builder project. However, if you still wish to install the CLI globally:
$ [sudo] npm install -g @axway/api-builder
Then, you will have an api-builder
command available that you can use as an alternative to npx @axway/api-builder
.
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.
$ npx @axway/api-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 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.
$ npx @axway/api-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.
$ npx @axway/api-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/api-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
npx @axway/api-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:
$ npx @axway/api-builder init myproject
Initialize a new project directory and download the Amplify Unified Catalog (requires login with the Axway CLI):
$ axway auth login
$ npx @axway/api-builder init --get-catalog myproject
npx @axway/api-builder get-catalog
Download the Amplify Unified Catalog from Amplify Central into an existing project directory.
Description
Authentication with the Amplify Platform 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):
$ npx @axway/api-builder get-catalog
npx @axway/api-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.