2.2 Export and report APIs - Axway-API-Management-Plus/apim-cli GitHub Wiki

The Axway API-Management CLI tool allows you to export APIs from the API-Manager for instance in order to promote them into the next stage or update the configuration.
To get started use the CLI with the following command: apim api get -h which provides you with a complete usage.

Export Backend-Basepath

Especially the resource path of the downstream application and the configured Backend-API host & Basepath play an important role to export and re-import the API correctly.

The following figure illustrates how exactly this information is exported:
Export paths

Filter the list of APIs

You can filter the list of APIs. Multiple filters are combined with AND. The following provides you with a few examples. Please check the usage (-h) for all filter options:

Command Comment/Description
apim api get -s prod Lists ALL APIs with standard information on the console
apim api get -s prod -policy "*Security*" -wide Lists ALL APIs using a policy Security on the console on a wider format
apim api get -s prod -name "*Banking*" -ultra Gets All APIs named Banking and prints them with all available information

Export Format

By default the get operation is using the console view and generates a table representation of the exported data. However, you can provide a --output or -o parameter to the get operation to control the export format you want.

Export API Resource / Method to handle method level tags and description.

By default the get operation does not export API methods tags and description. Use a parameter `-exportMethods' export API methods.

Console view

The amount of data shown in the console view depends on the toggle -wide or -ultra. If only ONE API is returned additionally to the data table a detail section is generated like in the example below.

+--------------------------------------+------------------------+--------------------+---------+--------+-------------+----------------------------+-------------+----------+-----------------+
| API-Id                               | Path                   | Name               | Version | V-Host | State       | Backend                    | Security    | Policies | Organization    |
+--------------------------------------+------------------------+--------------------+---------+--------+-------------+----------------------------+-------------+----------+-----------------+
| 528f9bf1-3597-465e-abf7-af1f7b2db640 | /sample/minimal/api/v1 | Sample Minimal API |   1.0.0 |        | unpublished | http://petstore.swagger.io | passThrough |          | API Development |
+--------------------------------------+------------------------+--------------------+---------+--------+-------------+----------------------------+-------------+----------+-----------------+

A P I  -  D E T A I L S
Organization:            API Development
Created On:              Wed Jun 24 22:45:50 CEST 2020
Created By:              API Administrator
Granted Organizations:   API Development
Subscribed applications:
Custom-Policies:         {REQUEST=[], FAULT_HANDLER=[], RESPONSE=[], ROUTING=[]}
Tags:
Custom-Properties:

JSON

This format gives you the JSON format as it's required to import the APIs with apim api import. For each exported API an export folder is created. Of course, you have the possibility to change that configuration file to prepare it for staging. For instance by adding variables or configuring the backend communication.

Command Comment/Description
apim api get -s prod Lists ALL APIs with standard information on the console
apim api get -s prod -id 8f7bd987-0736-43b.... -o json Export the API with the provided UUID into the current folder. Keep in mind the is changed, whenever the API is recreated.
apim api get -s qa --output json -t C:/axway/apis Gets All APIs from the QA-Stage exported into the given local folder. For each exported API a folder is automatically created.
apim api get -s dev --o json -t C:/axway/apis -useFEAPIDefinition This command is using the toggle: useFEAPIDefinition, which is useful, when you have created/designed the API using the API-Manager UI. In that case, the FE-API provides you a Swagger 2.0 definition instead of the internal Swagger 1.1

You can provide the option: -deleteTargetif you would like to replace existing folders.

Yaml

This format gives you the JSON format as it's required to import the APIs with apim api import. For each exported API an export folder is created.

Command Comment/Description
apim api get -s prod -n pestore -o yaml -t C:/axway/apis Get petstore API and store it local file system as yaml

CSV

A CSV based report allow your to see current applications subscriptions, which policies by each API and more information. Also this export is using the flags: -wide and -ulta to get more or less data.

Command Comment/Description
apim api get -s prod -o csv -wide Reports ALL APIs with standard information into the CSV-File
apim api get -s prod -policy "*Security Policy 1*" -o csv Exports all APIs using Security Policy 1 into the CSV-File.
apim api get -s qa --output csv -t C:/axway/apis/my_qa_apis.csv -ultra Gets All APIs from the QA-Stage exported into the given CSV-File.

If no target is given using the parameter -tor --target, the CSV-File is created in the current folder using the following naming convention: api_export_<stage|hostname>_<loginname>_<YYYYMMdd_HHmm>.csv

Excel report

⚠️ **GitHub.com Fallback** ⚠️