Skip to content

1. How to get started

Rathna edited this page Nov 1, 2024 · 12 revisions

Getting started with the API-Manager CLI is very simple.

Requirements
What you need to use the CLI on your machine

Where to get it
Learn where you get the APIM-CLI

Initial configuration
Some useful initial configuration steps you should read and follow

Use the CLI Java-APIs in your Java application
This is an advanced topic. You can use the CLI Java-APIs in your application.

Requirements

  • an up & running API-Manager Version 7.7 SP2 or later is required
  • Either an environment to execute a quite simple Shell-Script or BAT-File, which wraps a Java-Program
  • an installed Java Runtime Environment 11 or higher
  • the machine must have access to the API-Manager REST-API on Default-Port: 8075

Where to get it

Option 1: Download & Extract the release

  • Download the latest release from here
    • best is to extract the archive including the folder: (e.g. apim-cli-1.0.0) somewhere on your disk
      C:\Axway\Tools\apim-cli-1.2.3

Option 2: Use Chocolately

If you want to use the API-Management CLI on Windows and you are already using Chocolately.org the installation is just that simple:
choco install axway-apim-cli
To upgrade to the newest version just say:
choco upgrade axway-apim-cli
After installation you can just run apim

Initial configuration

Once you have loaded the APIM CLI, you can start using it immediately, but it is recommended that you perform the following configuration steps to make working with the CLI easier.

Setup AXWAY_APIM_CLI_HOME

Even if it is not necessary, it is recommended to add the environment variable: AXWAY_APIM_CLI_HOME This must point to the installation directory. Example: AXWAY_APIM_CLI_HOME=C:\Axway\Tools\apim-cli-1.3.0

On the next update you extract the archive to a new folder and update the environment variable AXWAY_APIM_CLI_HOME accordingly. If the variable set if it is used by the APIM-CLI start scripts as well as internally, e.g. to load configuration files from the conf folder.

Setup search path

To simplify the use of the CLI and to be able to call it at any place via apim, the operating-system search path should be set accordingly. Here it is recommended to use the environment variable: AXWAY_APIM_CLI_HOME. This way you can simply change only one variable with each update. Example for Windows: %AXWAY_APIM_CLI_HOME%\scripts

Setup environment properties

Instead of having to specify the environment parameters of your API-Management platform every time you call the CLI, it is better to create an environment file in the folder $AXWAY_APIM_CLI_HOME/conf.
For example, for the QA-Environment:
$AXWAY_APIM_CLI_HOME/conf/env.qa.properties

This file may contain a number of parameters, but should be at least

host=apimanager-hostname

username=myuser
password=mypassword

With that file in place, it's possible to call the CLI like so:
apim api get -s qa

For a complete overview of the possible parameters please refer to the file: env.properties.sample. More information about the environment files can be found here.

Use the CLI Java-APIs in your Java-Application

You may use Maven-Dependencies as part of your Java-Project to streamline communication with the API-Manager or just create a Jenkins Maven-Based pipeline workflow. Please check yourself on Maven-Central for the last available version: https://mvnrepository.com/artifact/com.github.axway-api-management-plus.apim-cli

Manage APIs

If you would like to manage APIs use the following dependency for your project:

<dependency>
	<groupId>com.github.axway-api-management-plus.apim-cli</groupId>
	<artifactId>apimcli-apis</artifactId>
	<version>1.2.1</version>
</dependency>

This dependency allows you to import/replicate and export APIs from your API-Manager. This is especially interesting when integrated into a pipeline based on Maven.

Manage Applications

<dependency>
	<groupId>com.github.axway-api-management-plus.apim-cli</groupId>
	<artifactId>apimcli-apps</artifactId>
	<version>1.2.1</version>
</dependency>

Manage Organizations

<dependency>
	<groupId>com.github.axway-api-management-plus.apim-cli</groupId>
	<artifactId>apimcli-organizations</artifactId>
	<version>1.2.1</version>
</dependency>

Manage Users

<dependency>
	<groupId>com.github.axway-api-management-plus.apim-cli</groupId>
	<artifactId>apimcli-users</artifactId>
	<version>1.2.1</version>
</dependency>