Giter Club home page Giter Club logo

apim-cli's Introduction

Axway API-Management CLI

License Apache2 Latest Release

Security Rating Reliability Rating Maintainability Rating Vulnerabilities Bugs

Coverage Lines of Code

downloads

This CLI allows you to control the Axway API management solution without access through the Web UI. You can call the CLI manually or integrate it into a CI/CD pipeline. The CLI is based on Swagger-Promote, which has been refactored to support more use-cases than only API-Import and -Export.

Everything as code

The basic idea for the so-called "Everything as code" approach is that the desired state of something (API, Application, etc.) is declared in a configuration file which stored in your version management system. A tool, like this CLI, is then replicating that declared state to become the actual state in the target environment. This is used for instance to manage complex Cloud-Infrastructure called Infrastructure as code. You may read more here: https://hackernoon.com/everything-as-code-explained-0ibg32a3

This CLI is following the same approach for your APIs, Applications, etc. Everything is declared as code in a config file and stored in your version management system. The CLI transfers this desired state manually or automatically via a pipeline into the API management platform to become the actual state.
Additionally the CLI supports basic administrative commands for instance to list and filter entities and perform simple tasks. More will be added very soon.

Watch this video (28 min): https://youtu.be/2i8i1zMAMps to get an overview + demo.

With that, an API developer or the operations team is just providing the desired state configuration of the API, Application. When checked in, the CI/CD-Pipeline picks it up and replicates it into the API Manager.

API Manager CLI overview

Supported commands

The CLI is flexible and is extended with new functions via modules. These can be accessed and discovered via the CLI on the basis of groups and their commands.
To get an overview about the groups just call apim:

Available commands and options:
apim app             Manage your applications 
apim settings        Manage your API-Manager Config/Remote-Hosts & Alerts
apim org             Manage your organizations
apim api             Manage your APIs 
apim user            Manage your users 

To get for instance a wide list of APIs on the stage: prod execute the following command:

apim api get -s prod -wide
....
+--------------------------------------+-----------------+----------------+---------+---------------------+-------------+-------------+----------+----------------------+
| API-Id                               | Path            | Name           | Version | V-Host              | State       | Security    | Policies | Organization         |
+--------------------------------------+-----------------+----------------+---------+---------------------+-------------+-------------+----------+----------------------+
| 518b15c9-350c-47d8-9ad6-16ce02ef9dfe | /vhost-test-950 | VHost Test 950 |   1.0.0 | api123.customer.com | unpublished | passThrough | None     | API Development 5538 |
| 39b7b2aa-7df8-44e0-b399-4e9d59dbad6d | /vhost-test-411 | VHost Test 411 |   1.0.0 | api123.customer.com |   published | passThrough | None     | API Development 5916 |
+--------------------------------------+-----------------+----------------+---------+---------------------+-------------+-------------+----------+----------------------+
......

To get a list of commands for each group call for instance apim app

The CLI is flexible and already provides a lot of commands & utility functions. For an up-to-date list of the supported groups and commands, see the documentation.

Quality assurance process

By using this CLI to control your Axway API management infrastructure it becomes a key component of your CI/CD process. Product quality is therefore very important so that you can be confident this CLI is doing what it's supposed to do.
To achieve this quality bar, the tools was developed from the beginning in a way that it can be tested fully automatically.
In addition to a number of executed unit-tests, sophisticated integration tests are performed. These integration tests are executed against different API-Management versions and consists of a number of different scenarios. Each scenrioa contains various Desired states, which are transferred into Actual state by the CLI and finally checked if the Actual State in the API-Manager is as expected. This is performed for APIs and applications.

The automated End-2-End test suite contains of 116 different scenarios, which includes more than 284 executions of CLI (Import & Export) following each by a validation step. The test suite is executed at Travis CI for the following versions and you may check yourself what is done by clicking on the badge icon:

Version Branch Status Comment
7.7-20240530 develop Build Status Requires version >=1.14.5
7.7-20240228 test-with-7.7-20240228 Build Status Requires version >=1.14.4
7.7-20230130 test-with-7.7-20231130 Build Status Requires version >=1.14.3
7.7-20230830 test-with-7.7-20230830 Build Status Requires version >=1.14.2
7.7-20230530 test-with-7.7-20230530 Build Status Requires version >=1.14.0
7.7-20230228 test-with-7.7-20230228 Build Status Requires version >=1.13.4
7.7-20221130 test-with-7.7-20221130 APIM CLI Integration test Requires version >=1.13.2, Multi-Org supported from version 1.13.3
7.7-20220830 test-with-7.7-20220830 APIM CLI Integration test Requires version >=1.13.0, Multi-Org is not yet supported
7.7-20220530 test-with-7.7-20220530 Build Status Requires version >=1.12.0, Multi-Org is not yet supported
7.7-20220228 test-with-7.7-20220228 Build Status Requires version >=1.10.1, Multi-Org is not yet supported
7.7-20211130 test-with-7.7-20211130 Build Status Requires version >=1.3.11, Multi-Org is not yet supported

At least version 7.7-20211130 is required.

Get started

To get started, you have several options to download the CLI and then just run the CLI as shown in the example below

scripts\apim api import -c samples/basic/minimal-config-api-definition.json -s api-env

This command is reading the API-Management platform configuration details from the environment file: env.api-env.properties and replicates the given desired API state in the configuration file: minimal-config-api-definition.json into the API-Management platform.

Please see the documentation for more information.

Changelog

See change log

Contributing

Contributions welcome

Please read Contributing.md for details on our code of conduct, and the process for submitting pull requests to us.
Also please read this page on how to contribute to this project.

Team

alt text Axway Team

License

Apache License 2.0

apim-cli's People

Contributors

cbrowet-axway avatar davidgeiger avatar dependabot[bot] avatar gcornacchia avatar gwandwingor avatar hakila avatar henelyt avatar kervoaz avatar rathnapandi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apim-cli's Issues

[BUG] V-Host not set when API initially on state unpublished

API-Mgr. CLI version
1.0.0

API-Manager and Service-Pack Version
7.7.0

Expected behavior
When an API is initially registered for the first time (No existing API found) the V-Host should be set.

Actual behavior
Only when the API is in state published, the V-Host is set. When going back from published to unpublished, the V-Host is also set.

Test case sample

{
  "name": "Axway Imagine - Weather API",
  "path": "/api/v1/weather",
  "state": "unpublished",
  "version": "1.0.0",
  "organization": "API Development",
  "apiDefinition": "../petstore.json",
  "vhost": "myhost.custom.com:8065"
}

[New feature] Support for Yaml files when replacing host in API definition file

The API definition file (parameter apiDefinition) can be both Json and Yaml as API Manager 7.7 supports both formats. However, when the parameter backendBasepath is specified, then the promote tool tries to change the corresponding parameters in the Swagger file - and this fails because the promote tool is only capable of parsing the Json format.

With this change the promote tool will be able to support the Yaml format when the backendBasepath parameter is specified.

Behaviour when no host is specified in swagger file

Hi,

I wonder how does the apim-cli behaves when no "host" field is provided in a swagger file ?

I recently found that in apimanager-swagger-promote v1.6.7-1, when such a thing occurred, the following error was thrown but the API was still successfully imported and backend host was set to "http://", which doesn't help since the Frontend API will not be able to reach any backend.

Would such a behaviour be the same in apim-cli, I think the most useful thing to do would be to :

  • if no "backendBasepath" is specified in the config file : end the API processing with an error status so the problem can be addressed straight away.
  • if "backendBasepath" is specified in the config file : create the "host" entry in the swagger file and set it to the "backendBasepath" host

log example with swagger-promote :

------------------------------------------------------------------------
API-Manager Promote: 1.6.7-1 - I M P O R T
                                                                        
To report issues or get help, please visit: 
https://github.com/Axway-API-Management-Plus/apimanager-swagger-promote
------------------------------------------------------------------------

0      INFO  nvironmentProperties| Trying to load environment properties from file: env.properties ... not found.
0      INFO  nvironmentProperties| Trying to load environment properties from file: env.DEV.properties ... not found.
663    WARN  sponseProcessCookies| Invalid cookie header: "Set-Cookie: SSOSPAPIMAN=deleted;Version=1;Comment=;Domain=;Path=/api/portal/v1.3/;Max-Age=0;Secure;HttpOnly". Blank or null value for domain attribute
1010   INFO  IImportConfigAdapter| Loaded stage API-Config from file: /home/jenkins/agent/workspace/livery-apimgr-mobileoperator_DEV/download/api/apimgr-mobileoperator/common-api/config/common-config.DEV.json
1109   INFO  IImportConfigAdapter| Reading API-Definition (Swagger/WSDL) from file: '/home/jenkins/agent/workspace/livery-apimgr-mobileoperator_DEV/download/api/apimgr-mobileoperator/common-api/swagger/common-api.json' (relative path)
1127   ERROR     APISpecification| Cannot replace host in provided Swagger-File. Continue with given host.
java.lang.NullPointerException
	at com.axway.apim.api.definition.Swagger2xSpecification.configureBasepath(Swagger2xSpecification.java:55)
	at com.axway.apim.api.definition.Swagger2xSpecification.configure(Swagger2xSpecification.java:93)
	at com.axway.apim.api.definition.APISpecificationFactory.getAPISpecification(APISpecificationFactory.java:41)
	at com.axway.apim.apiimport.APIImportConfigAdapter.getDesiredAPI(APIImportConfigAdapter.java:218)
	at com.axway.apim.App.run(App.java:227)
	at com.axway.apim.App.main(App.java:53)
1264   INFO  IImportConfigAdapter| Handling configured client-applications.
1405   INFO  IImportConfigAdapter| Found existing application: 'MOBILE-SAFETY-MOB-REACT-DEV' (null) based on given name 'MOBILE-SAFETY-MOB-REACT-DEV'
1405   INFO  IImportConfigAdapter| Found existing application: 'MOBILE-SAFETY DEV' (null) based on given name 'MOBILE-SAFETY DEV'
1442   INFO     APIManagerAdapter| API-Manager version is: 7.5.3 SP12
1443   INFO               Proxies| Sending request to find existing APIs: https://apim-group-dev.tools.endpoint:8075/api/portal/v1.3/proxies
1677   INFO               Proxies| No existing API found based on filter: [apiPath=/dev/mobile-operator/common filter=[]]
1681   INFO      APIImportManager| Strategy: No existing API found, creating new!
1684   INFO     APIManagerAdapter| Importing backend API (Swagger/WSDL Import)
1811   INFO     APIManagerAdapter| Create API-Proxy (Front-End API)
5210   INFO     APIManagerAdapter| Updating Frontend-API (Proxy) for the following properties: caCerts securityProfiles tags corsProfiles path name summary 
5391   INFO     APIManagerAdapter| Creating API-Access for the following apps: '[[MOBILE-SAFETY-MOB-REACT-DEV], [MOBILE-SAFETY DEV]]'
5479   INFO                   App| Successfully replicated API-State into API-Manager 

Add a 'forceUpdate' flag to force the update of an API

Following question #55 ,

In some cases, it is required to force the apim-cli to update an already existing API. For instance, to update the password of an http_basic authenticationProfile.
Currently, in v7.7 some elements (such as passwords) are no longer returned by API Manager REST API, meaning that apim-cli is unable to determine whether or not they need to be updated in API Manager.

It would be helpful to have a "forceUpdate" flag either in the commandLine to indicate apim-cli that the whole content of the api contract file needs to be reapplied.

Log more information if API-Specification can't be handled

User story
Especially when doing a mass API-Export it's important to know, for which API the API-Specification cannot be handled. Right now, the following exception is logged:

Loading 385 APIs [******----] 60%java.lang.StringIndexOutOfBoundsException: String index out of range: 100
        at java.lang.String.checkBounds(Unknown Source)
        at java.lang.String.<init>(Unknown Source)
        at com.axway.apim.api.definition.WSDLSpecification.configure(WSDLSpecification.java:36)
        at com.axway.apim.api.definition.APISpecificationFactory.getAPISpecification(APISpecificationFactory.java:42)
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.addOriginalAPIDefinitionFromAPIM(APIManagerAPIAdapter.java:488)
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.getAPIs(APIManagerAPIAdapter.java:125)
        at com.axway.apim.APIExportApp.runExport(APIExportApp.java:104)
        at com.axway.apim.APIExportApp.export(APIExportApp.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:142)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:78)
249613 ERROR         APIExportApp| Can't read Swagger-File.
com.axway.apim.lib.errorHandling.AppException: Can't read Swagger-File.
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.addOriginalAPIDefinitionFromAPIM(APIManagerAPIAdapter.java:491)
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.getAPIs(APIManagerAPIAdapter.java:125)
        at com.axway.apim.APIExportApp.runExport(APIExportApp.java:104)
        at com.axway.apim.APIExportApp.export(APIExportApp.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:142)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:78)
Caused by: com.axway.apim.lib.errorHandling.AppException: Can't handle API specification. No suiteable specification implementation found.
        at com.axway.apim.api.definition.APISpecificationFactory.getAPISpecification(APISpecificationFactory.java:52)
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.addOriginalAPIDefinitionFromAPIM(APIManagerAPIAdapter.java:488)
        ... 9 more

With that, the user can't identify / solve the issue as you don't know which API is causing the problem.

The API-Name/Path must be logged and best would be to log at least first 100 characters of the specification to see what has being returned by the API-Manager.

Import beAPI only

API-Manager CLI Version
API-Manager CLI: 1.2.1

API-Manager and Service-Pack Version
7.5.3 SP12

Question
Is it possible to import a beAPI only?

What I've tried so far
apim api import, and a couple of configurations of config file

Additional information
N/A

[BUG] Wrong info text during update of an unpublished API proxy

API-Mgr. CLI version
1.0.0
API-Manager and Service-Pack Version
7.6.2 SP4

Expected behavior

Actual behavior
As OrgAdmin, if I upgrade an existing unpublished API proxy because of a change in the swagger file I get the info text that the API is waiting for an approval by an administrator. This is wrong, as the API is still unpublished.

Log-Output in Debug
4620 INFO APIImportManager| Actual API has been created and is waiting for an approval by an administrator. You may update the pending API as often as you want before it is finally published.

Test case sample

Please describe the steps you have done to replicate the issue

Organization override not working as expected during import

API-Mgr. CLI version
v1.2.1

API-Manager and Service-Pack Version
v7.7.2000330

Expected behavior
Organization specified in api-config.<stage>.json should be the only one taken into account, and the one from the base conf ignored.

Actual behavior
The organization from the base api-config.json is checked upon the target environment, and import fails if the organization does not exists.
If "organization" is removed from the base json, import does proceed.

Log-Output in Debug

----------------------------------------------------------------------------------------
API-Manager CLI: 1.2.1

To report issues or get help, please visit:
https://github.com/Axway-API-Management-Plus/apim-cli
----------------------------------------------------------------------------------------
Module: API - I M P O R T (1.2.1)
----------------------------------------------------------------------------------------
1      WARN  sponseProcessCookies| Invalid cookie header: "Set-Cookie: spExternalSSOSessionId3=deleted;Version=1;Comment=;Domain=;Path=/api/portal/v1.3/;Max-Age=0;Secure;HttpOnly". Blank or null value for domain attribute
134    INFO     APIManagerAdapter| Successfully connected to API-Manager (7.7.20200331) on: https://<retracted>:8075
530    INFO  rOrganizationAdapter| No organization found using filter: OrgFilter [name=xxxx, id=null]
532    ERROR         APIImportApp| The given organization: 'xxxx' is unknown.
532    ERROR         APIImportApp| Cant parse JSON-Config file(s)

Test case sample
command: scripts/apim.sh api import -s tst -a apim/grocery-mock/grocery-mock.json -c apim/grocery-mock/api-config.json

Base config (api-config.json):

{
  "name" : "grocery-mock",
  "path" : "/grocery-mock",
  "state" : "unpublished",
  "version" : "1.0",
  "organization" : "xxx",
  "apiDefinition" : "grocery-mock.json",
  "vhost" : "<retracted>",
  "clientOrganizations" : [ "xxx" ]
}

Stage api config (api-config.tst.json)

{
  "backendBasepath" : "${MOCK}",
  "organization" : "API Development",
  "clientOrganizations" : [ "API Development" ]
}

[BUG] API custom properties are missing in API export

API-Mgr. CLI version
1.0.0

API-Manager and Service-Pack Version
7.6.2 SP4

Expected behavior
As I am able to import API custom properties, I would expect to export the same.

Actual behavior
As orgAdmin if I export an API with apim api get -id ... -f json, the API proxy gets exported but without custom properties.

Log-Output in Debug

Test case sample

Please describe the steps you have done to replicate the issue

Filter applications based on their configured credentials

User story
It is sometimes required to select/filter applications based on their configured Application-Credentials such as the Client-ID or API-Key.

Additional context
This is useful as sometimes only the Client-ID is known out of logs and without that option, it is hard to know which API it is.

New operation to Publish APIs

User story
It should be supported to publish one or multiple APIs using a command like so:
apim api publish -s api-env <FILTER_THE_APIS_AS_YOU_LIKE>

The actual state of APIs must be unpublished. If an API is already published, the CLI should do nothing.

[Bug] property apiMethodId contains UUID after export instead of a path value - import fails

API-Mgr. CLI version
1.1.0

API-Manager and Service-Pack Version
7.6.2 SP4

Expected behavior

Actual behavior
I configured a per method override and did an export as JSON via "apim api get -id ... -o json".
The import again seems to work but is inconsistent as the Backend API service URL is now an id instead of a path.
Checking the exported api config file, I assume there was a change in the property apiMethodId which change from a path value to a UUID.

Log-Output in Debug

Test case sample

Please describe the steps you have done to replicate the issue

NullPointer Exception when trying to configure backendBasepath

API-Mgr. CLI version
1.2.2

API-Manager and Service-Pack Version
7.7-July release

Expected behavior
The Swagger 2.0 specificaion should be configured according to the configured backendBasepath (e.g. "backendBasepath": "http://192.168.65.1:8080/api/api/v1/weather"

Actual behavior
A NullPointerException occurs, if the given Swagger-File doesn't contain a basepath already.

Log-Output in Debug

1      INFO     APIManagerAdapter| Successfully connected to API-Manager (7.7.20200730) on: https://api-env:8075
532    INFO  IImportConfigAdapter| Reading API-Definition (Swagger/WSDL) from file: '/home/axway/.jenkins/jobs/My-Projects/jobs/airports/branches/master/workspace/app/airports/endpoints/airports-api.json' (absolute path)
586    ERROR     APISpecification| Cannot replace host in provided Swagger-File. Continue with given host.
java.lang.NullPointerException
	at com.axway.apim.api.definition.Swagger2xSpecification.configureBasepath(Swagger2xSpecification.java:58)
	at com.axway.apim.api.definition.Swagger2xSpecification.configure(Swagger2xSpecification.java:98)
	at com.axway.apim.api.definition.APISpecificationFactory.getAPISpecification(APISpecificationFactory.java:44)
	at com.axway.apim.api.definition.APISpecificationFactory.getAPISpecification(APISpecificationFactory.java:28)
	at com.axway.apim.apiimport.APIImportConfigAdapter.getDesiredAPI(APIImportConfigAdapter.java:222)
	at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:68)
	at com.axway.apim.APIImportApp.main(APIImportApp.java:45)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:282)
	at java.lang.Thread.run(Thread.java:748)
1771   INFO  APIManagerAPIAdapter| Found existing API on path: '/api/v1/airports' (unpublished) (ID: '7c472faf-3c6e-4160-bb3b-7b0430fbbdbd'
2083   INFO      APIImportManager| Recognized the following changes. Potentially Breaking: [authenticationProfiles] plus Non-Breaking: [image]
2083   INFO      APIImportManager| Update API Strategy: All changes can be applied in current state.
2084   INFO     UpdateExistingAPI| Update existing unpublished API: 'Airports API' 1.0.0 (ID: 7c472faf-3c6e-4160-bb3b-7b0430fbbdbd)
2084   INFO        APIChangeState| Updating Frontend-API (Proxy) for the following properties: image authenticationProfiles 
2289   INFO  APIManagerAPIAdapter| Updating API-Image from: airports-image.png
2622   INFO     UpdateExistingAPI| Successfully updated unpublished API: 'Airports API' 1.0.0 (ID: 7c472faf-3c6e-4160-bb3b-7b0430fbbdbd)

TEST

API-Mgr. CLI version

Please make sure to use the latest available version before reporting a bug.

API-Manager and Service-Pack Version

Expected behavior

Actual behavior

Log-Output in Debug

Test case sample

Please describe the steps you have done to replicate the issue

Inbound-Security policy is not part of the report generated by API -CLI.

User story

the Inbound-Security policy is not part of the report. Only Request-, Routing- and Response-Policies are available today.

Command : apim api get -s api-env -o csv -wide

We need Inbound-Security policy ("Frontend API -> Inbound -> Inbound Security -> *Policy to invoke") value as a column in my custom report for all the APIs.

Discussed the above issue with @cwiechmann . He suggested to create this enhancement issue so he would add this with next release.

Additional context

[BUG] Cannot set Oauth authentication Profile using its name

APIM-CLI version

Please make sure to use the latest Swagger-Promote version.
1.0.0-RC1

API-Manager and Service-Pack Version
7.7.20200130

Expected behavior
Documentation says Oauth type outbound authentication profiles can be created using their names

https://github.com/Axway-API-Management-Plus/apim-cli/wiki/2.3-Configure-API-Outbound-Authentication#oauth

         "parameters":{
            "providerProfile":"<Name-of-configured-OAuth-Profile>",
            "ownerId":"${authentication.subject.id}"
         },
         "type":"oauth"

Outbound authentication profiles should be configured the same way as Request/Routing/Response policies, using their names instead of their complete EntityStore reference.

Actual behavior
Only EntityStore type references to profile such as below are accepted by Swagger Promote.

  "authenticationProfiles" : [ {
    "name" : "_default",
    "isDefault" : true,
    "parameters" : {
      "providerProfile" : "<key type='AuthProfilesGroup'><id field='name' value='Auth Profiles'/><key type='OAuthGroup'><id field='name' value='OAuth2'/><key type='OAuthProviderProfile'><id field='name' value='Google'/><key type='OAuthAppProfile'><id field='name' value='Test Credentials'/></key></key></key></key>",
      "ownerId" : "${authentication.subject.id}"
    },
    "type" : "oauth"
  } ],

When only profile name is provided, outbound authentication profile is created but link to profile is empty

image

Log-Output in Debug

Test case sample

Please describe the steps you have done to replicate the issue

  1. Create Oauth2 Client credentials named "Test Credentials" in Policy studio and make them available to API Manager sections of the Server Settings.
  2. Create an API configuration using following JSON sample
 "authenticationProfiles" : [ {
    "name" : "_default",
    "isDefault" : true,
    "parameters" : {
      "providerProfile" : "Test Credentials",
      "ownerId" : "${authentication.subject.id}"
    },
    "type" : "oauth"
  } ], 
  1. Deploy API
  2. Check imported Frontend API in API Manager

[Feature] Update a KPS table

User story
Some APIs need updates in KPS tables. Swagger promote should support a generic way to specify a KPS table and properties so it can do the insertions/removals. (The key of the KPS table is always the api.id field.)

Additional context

Error creating/updating organization #2

API-Mgr. CLI version
1.2.2

API-Manager and Service-Pack Version
7.6.2 SP2

I tried again importing organization, modifying the description and then again importing to api manager with the new version 1.2.2.
I got the same error as mentioned in issue #69, I tried to run ImportSimpleOrganizationTestIT on my api Manager and it fails.

This is the final part of the log of integration test.

13539  INFO  tionImportTestAction| Copy certificates and images from source: D:\Git\BancoBPM\apim-cli\modules\organizations\target\test-classes\com\a
xway\apim\organization\orgImport into test-dir: 'C:\Users\ADMIN\AppData\Local\Temp\OrgImportActionTest-My-Org-9465-7057'
13542  INFO  tionImportTestAction| Ignoring admin account: 'false' | Enforce breaking change: false | useEnvironmentOnly: false
15361  INFO     APIManagerAdapter| Successfully connected to API-Manager (7.6.2 SP2) on: https://192.168.2.43:8075
16626  ERROR rOrganizationAdapter| Error creating/updating organization. Response-Code: 404. Got response: '{"errors":[{"code":102,"message":"Not Fou
nd"}]}'
16627  ERROR   OrganizationCLIApp| Error creating/updating organization
com.axway.apim.lib.errorHandling.AppException: Error creating/updating organization
        at com.axway.apim.adapter.apis.APIManagerOrganizationAdapter.createOrUpdateOrganization(APIManagerOrganizationAdapter.java:168)
        at com.axway.apim.adapter.apis.APIManagerOrganizationAdapter.updateOrganization(APIManagerOrganizationAdapter.java:112)
        at com.axway.apim.organization.OrganizationImportManager.replicate(OrganizationImportManager.java:33)
        at com.axway.apim.organization.OrganizationCLIApp.importOrganization(OrganizationCLIApp.java:148)
        at com.axway.apim.organization.OrganizationImportTestAction.doExecute(OrganizationImportTestAction.java:107)
        at com.axway.apim.organization.orgImport.ImportSimpleOrganizationTestIT.run(ImportSimpleOrganizationTestIT.java:60)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:216)
        at com.consol.citrus.dsl.testng.TestNGCitrusTest.invokeTestMethod(TestNGCitrusTest.java:139)
        at com.consol.citrus.dsl.testng.TestNGCitrusTest.run(TestNGCitrusTest.java:110)
        at com.consol.citrus.dsl.testng.TestNGCitrusTest.run(TestNGCitrusTest.java:56)
        at org.testng.internal.MethodInvocationHelper.invokeHookable(MethodInvocationHelper.java:201)
        at org.testng.internal.Invoker.invokeMethod(Invoker.java:642)
        at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:811)
        at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1137)
        at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
        at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
        at org.testng.TestRunner.privateRun(TestRunner.java:753)
        at org.testng.TestRunner.run(TestRunner.java:607)
        at org.testng.SuiteRunner.runTest(SuiteRunner.java:368)
        at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:363)
        at org.testng.SuiteRunner.privateRun(SuiteRunner.java:321)
        at org.testng.SuiteRunner.run(SuiteRunner.java:270)
        at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
        at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
        at org.testng.TestNG.runSuitesSequentially(TestNG.java:1284)
        at org.testng.TestNG.runSuitesLocally(TestNG.java:1209)
        at org.testng.TestNG.runSuites(TestNG.java:1124)
        at org.testng.TestNG.run(TestNG.java:1096)
        at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:132)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:112)
        at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:99)
        at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:147)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121)
Caused by: com.axway.apim.lib.errorHandling.AppException: Error creating/updating organization.
        at com.axway.apim.adapter.apis.APIManagerOrganizationAdapter.createOrUpdateOrganization(APIManagerOrganizationAdapter.java:157)
        ... 38 more
Caused by: com.axway.apim.lib.errorHandling.AppException: Error creating/updating organization. Response-Code: 404
        at com.axway.apim.adapter.apis.APIManagerOrganizationAdapter.createOrUpdateOrganization(APIManagerOrganizationAdapter.java:153)
        ... 38 more
16630  INFO       LoggingReporter|
16630  ERROR      LoggingReporter| TEST FAILED ImportSimpleOrganizationTestIT.run <com.axway.apim.organization.orgImport> Nested exception is:
com.consol.citrus.exceptions.ValidationException: Expected RC was: 0 but got: 35

[Feature]Be able to load the config file from a remote location

User story
Would like to be able to store the Swagger-Promote config json in a source repository with the API definition. Swagger-Promote would then provide the remote address to the config file when passing in the -c option. So, would like our command to look like `./scripts/run-swagger-import.sh -a https://bitbucket/repository/service-swagger.json -c https://bitbucket/repository/service-config.jsonโ€™.

Additional context
This would allow us to NOT store the config files locally to our CI/CD process that Jenkins is running to accomplish these promotes.

apim.sh issues

Hi Christoph,

Some issues with apim.sh:

  • the distributed version has DOS eol
  • "type -p" is a bash-ism; maybe "command -v" is more posix-compliant

[BUG] NullPointerException with option -ultra

API-Mgr. CLI version
1.0

API-Manager and Service-Pack Version
7.6.2 SP4

Expected behavior

Actual behavior
With OrgAdmin credentials, if I run apim api get ... with the option -ultra, I am getting a NullPointerException
It works fine with -wide!

Log-Output in Debug

java.lang.NullPointerException
        at com.axway.apim.api.export.impl.ConsoleAPIExporter.getOrgCount(ConsoleAPIExporter.java:141)
        at com.axway.apim.api.export.impl.ConsoleAPIExporter.lambda$printUltra$22(ConsoleAPIExporter.java:80)
        at com.github.freva.asciitable.ColumnData.getCellValue(ColumnData.java:15)
        at com.github.freva.asciitable.AsciiTable.lambda$null$0(AsciiTable.java:40)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:545)
        at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
        at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:438)
        at com.github.freva.asciitable.AsciiTable.lambda$getTable$2(AsciiTable.java:41)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:545)
        at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
        at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:438)
        at com.github.freva.asciitable.AsciiTable.getTable(AsciiTable.java:42)
        at com.axway.apim.api.export.impl.ConsoleAPIExporter.printUltra(ConsoleAPIExporter.java:70)
        at com.axway.apim.api.export.impl.ConsoleAPIExporter.execute(ConsoleAPIExporter.java:41)
        at com.axway.apim.APIExportApp.runExport(APIExportApp.java:98)
        at com.axway.apim.APIExportApp.export(APIExportApp.java:43)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:138)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:76)

Test case sample

Please describe the steps you have done to replicate the issue

[Feature] Manually created API - Get API-Definition as Swagger 2.0 from Catalog API

User story
In order to load the Actual-API representation the CLI is requesting the "Original API-Definition" from the API-Manager, which has been imported before.
http://apidocs.axway.com/swagger-ui/index.html?productname=apimanager&productversion=7.7.0&filename=api-manager-V_1_3-swagger.json#!/API_Repository/get_apirepo_id_download
This makes sense, when using an external API-Design-Tool as Stoplight, as this API-Definition is the single source of truth.
But, when the API has been created manually using the API-Manager UI, there is no "Original" to download and the API-Manager returns a 1.1 Swagger-Definition instead, which is quite unhandy, as the standard is old and for instance not compatible with Stoplight. This makes the workflow more cumbersome.

The CLI should provide an option to download the Swagger 2.0 definition instead, which is available to download from the Catalog-View.
image

Getting error while exporting SOAP API's

API-Mgr. CLI version

Please make sure to use the latest available version before reporting a bug.

1.1.0

API-Manager and Service-Pack Version
7.6.2/SP3

Expected behavior

should be able to export SOAP API's as well.

Actual behavior

getting error while exporting SOAP API's. Works fine for REST APIs.

Log-Output in Debug

apim api get -s dev -id 676834c0-f3f8-4502-97ac-c19509b58edd --o json -t C:\axway\apis

----------------------------------------------------------------------------------------
API-Manager CLI: 1.1.0

To report issues or get help, please visit:
https://github.com/Axway-API-Management-Plus/apim-cli
----------------------------------------------------------------------------------------
Module: API - E X P O R T / U T I L S (1.1.0)
----------------------------------------------------------------------------------------
928    INFO     APIManagerAdapter| Successfully connected to API-Manager (7.6.2 SP3) on: https://xxxxxxxxxxxxxx:8075
6130   ERROR         APIExportApp| Can't read Swagger-File.
com.axway.apim.lib.errorHandling.AppException: Can't read Swagger-File.
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.addOriginalAPIDefinitionFromAPIM(APIManagerAPIAdapter.java:491)
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.getAPIs(APIManagerAPIAdapter.java:125)
        at com.axway.apim.APIExportApp.runExport(APIExportApp.java:104)
        at com.axway.apim.APIExportApp.export(APIExportApp.java:48)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:138)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:76)
Caused by: com.axway.apim.lib.errorHandling.AppException: Can't handle API specification. No suiteable specification implementation found.
        at com.axway.apim.api.definition.APISpecificationFactory.getAPISpecification(APISpecificationFactory.java:52)
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.addOriginalAPIDefinitionFromAPIM(APIManagerAPIAdapter.java:488)
        ... 9 more

api api import error

API-Manager CLI Version
1.2.1

API-Manager and Service-Pack Version
7.7.0

Question
When running the apim api import command on Linux, i'm getting the error message:

Using java given in JAVA_HOME

----------------------------------------------------------------------------------------
API-Manager CLI: 1.2.1

To report issues or get help, please visit:
https://github.com/Axway-API-Management-Plus/apim-cli
----------------------------------------------------------------------------------------
Module: API - I M P O R T (1.2.1)
----------------------------------------------------------------------------------------
0      INFO     APIManagerAdapter| Successfully connected to API-Manager (7.7.0) on: https://apimanager-hml.autoglass.com.br:443
7      ERROR         APIImportApp| Cant parse JSON-Config file(s)
8      ERROR         APIImportApp| Cant parse JSON-Config file(s)
com.axway.apim.lib.errorHandling.AppException: Cant parse JSON-Config file(s)
        at com.axway.apim.apiimport.APIImportConfigAdapter.<init>(APIImportConfigAdapter.java:163)
        at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:66)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:142)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:78)
Caused by: com.axway.apim.lib.errorHandling.AppException: Unable to find given Config-File: './import.config-hml.json'
        at com.axway.apim.apiimport.APIImportConfigAdapter.locateAPIConfigFile(APIImportConfigAdapter.java:178)
        at com.axway.apim.apiimport.APIImportConfigAdapter.<init>(APIImportConfigAdapter.java:147)

What I've tried so far
Configured correctly the JAVA_HOME environment variable
Tried to execute the script from various locations
Verified the config file permissions

Additional information

How to update authenticationProfile http_basic password ?

API-Manager CLI Version
1.2.1

API-Manager and Service-Pack Version
7.7.20200530

Question
In the documentation, it is stated :

Please note: Starting from API-Manager Version 7.7 SP1 & 7.6.2 SP5 the password is not exposed anymore by the REST-API. Therefore Swagger-Promote can't use it anymore to compare the Desired with the Actual state. In order to change the password another field of the Desired state must be changed as well.

If the password used in an http_basic type authenticationProfile has changed and needs to be updated in API Manager, what do you recommend doing to trigger such an update ? There's not many possibilities in terms of "non-impacting" fields to trigger such an update.

What I've tried so far
I tried to change the "name" field of the authenticationProfile but it didn't trigger a change.
"name": "_default", into "name":"_newname"

Additional information
Since API Manager REST API behavious seems to have changed in 7.7 and there doesn't seem to be a way to determine whether a password has changed or not, wouldn't it be safer to assume by default that it changed and trigger the authenticationProfile update anyway ? maybe using some kind of "force" flag ?

[BUG] Documentation issue in How to get started

API-Mgr. CLI version
1.1.0

API-Manager and Service-Pack Version
N/A

Expected behavior

Actual behavior
The described way in Option 1 by adding the Short-Cut-Folder to the PATH does not work.
e.g. adding just "C:\Axway\Tools\apim-cli" to the PATH works, but adding "C:\Axway\Tools\apim-cli\scripts" does not.
If you try to open "C:\Axway\Tools\apim-cli\scripts" in windows explorer you will get an error.

Log-Output in Debug

Test case sample

Please describe the steps you have done to replicate the issue

[BUG] Error while creating/updating API Access

API-Mgr. CLI version
1.0.1

API-Manager and Service-Pack Version
7.6.2 SP4

Expected behavior

Actual behavior
From time to time (I assume it is a caching problem) APIM CLI performs rollback action because of an error (error creating/updating API Access) if I update or delete an API proxy as orgAdmin.

Log-Output in Debug
API-Manager CLI: 1.0.1

To report issues or get help, please visit:
https://github.com/Axway-API-Management-Plus/apim-cli
------------------------------------------------------------------------
Module: API - I M P O R T (1.0.1)
------------------------------------------------------------------------
0      INFO     APIManagerAdapter| Successfully connected to API-Manager (7.6.2 SP4) on: ...
235    WARN  rOrganizationAdapter| Using OrgAdmin only to load all organizations.
541    INFO  IImportConfigAdapter| Reading API-Definition (Swagger/WSDL) from file: 'petstore.json' (relative path)
794    INFO  IImportConfigAdapter| Handling configured client-applications.
1073   INFO  IImportConfigAdapter| Found existing application: 'Petstore Test' (null) based on given name 'Petstore Test'
1142   INFO  IImportConfigAdapter| Found existing application: 'Petstore Test2' (null) based on given name 'Petstore Test2'
1260   INFO      APIImportManager| No existing API found, creating new!
1386   INFO          CreateNewAPI| Create deleted API: 'Petstore API' 1.0.5 based on Swagger 2.0 specification.
1701   INFO  APIManagerAPIAdapter| API: Petstore API successfully deleted
1766   INFO      ManageClientApps| Creating API-Access for the following apps: '[[Petstore Test], [Petstore Test2]]'
1767   INFO      ManageClientApps| Creating API-Access for application 'Petstore Test'
1849   WARN  agerAPIAccessAdapter| Got unexpected error: 'Unknown API' while creating API-Access ... Try again in 1 second.
2917   ERROR agerAPIAccessAdapter| Error creating/updating API Access: APIAccess [apiName=null, apiVersion=null, id=null, apiId=4285df12-2c60-4fd2-8474-b3e499a7f4e9]. Response-Code: 403. Got response: '{"errors":[{"code":403,"message":"Unknown API"}]}'
2920   INFO        RollbackAction| Rollback FE-API: 'Petstore API' (ID: '4285df12-2c60-4fd2-8474-b3e499a7f4e9' / State: 'unpublished')
3114   ERROR       RollbackAction| Error while deleting FE-API to roll it back
java.lang.NullPointerException
        at com.axway.apim.adapter.APIStatusManager.update(APIStatusManager.java:80)
        at com.axway.apim.adapter.APIStatusManager.update(APIStatusManager.java:63)
        at com.axway.apim.apiimport.rollback.RollbackAPIProxy.rollback(RollbackAPIProxy.java:28)
        at com.axway.apim.apiimport.rollback.RollbackHandler.executeRollback(RollbackHandler.java:60)
        at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:99)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:138)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:76)
3155   ERROR APIManagerAPIAdapter| Error deleting Backend-API. Response-Code: 403, Response: '{"errors":[{"code":403,"message":"Forbidden"}]}'
3156   ERROR       RollbackAction| Error while deleting BE-API with ID: '7e90ddca-e703-4a1e-b5da-61d095e2102a' to roll it back
com.axway.apim.lib.errorHandling.AppException: Cannot delete Backend-API.
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.deleteBackendAPI(APIManagerAPIAdapter.java:592)
        at com.axway.apim.apiimport.rollback.RollbackBackendAPI.rollback(RollbackBackendAPI.java:25)
        at com.axway.apim.apiimport.rollback.RollbackHandler.executeRollback(RollbackHandler.java:60)
        at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:99)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:138)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:76)
Caused by: com.axway.apim.lib.errorHandling.AppException: Error deleting Backend-API. Response-Code: 403
        at com.axway.apim.adapter.apis.APIManagerAPIAdapter.deleteBackendAPI(APIManagerAPIAdapter.java:589)
        ... 9 more
3158   INFO       RollbackHandler| Rolled back: '[Frontend-API: false, Backend-API: false]'
3159   ERROR         APIImportApp| Unable to find API with ID: 4285df12-2c60-4fd2-8474-b3e499a7f4e9. Please have in mind during API-Update the ID is re-created!

Import/Export general API Manager settings

hi @cwiechmann, congrats for your great job for this tool!!!

Have you ever thought about handling the general API manager settings in the same approach (desired vs. actual state)? I refer to all the settings that you can manually change in Api Manager web interface -> Settings menu

thanks

More than one api import in single command

More than one API import in single api-cli command

In current we can able to import one API with import command but can we try importing multiple API in single command

Application API-Access - Missing API - Improve error message to include App-Name

User story
To which APIs an application has access to is maintained as something called API-Access, which as the following structure:

[
  {
    "id": "e89e56da-db39-422b-9819-bfcbaa4ca597",
    "apiId": "02bbb536-bc64-4b34-ac4e-514b370cc560",
    "createdBy": "ed9d3d7e-5876-4701-b496-405e426f6e42",
    "state": "approved",
    "createdOn": 1535102783458,
    "enabled": true
  },
  {
    "id": "3d33ab7a-4256-4348-8748-a02cc7eb201e",
    "apiId": "0ab8eb91-b8ff-41ae-b4cf-b8a7cf18a74d",
    "createdBy": "064abe21-8bd9-4faa-874e-856c9d428abb",
    "state": "approved",
    "createdOn": 1580982584503,
    "enabled": true
  }
]

So, that means it is an Array, each containing the granted apiId. Sometimes, due to some unknown reasons, an API referenced in an API-Access might not be existing anymore. In that case the following error is reported:
com.axway.apim.lib.errorHandling.AppException: Unable to find API with ID: e54faa6b-1f52-4b83-8aa7-07e363475285

This is causing for instance the API-Export JSON to write the export file as the actual state couldn't really be loaded.
Unfortunately this error message doesn't help to solve the problem, as the user doesn't know, which application is causing the problem.

Hence, the error message must contain the Application-Name to give users a chance to solve the issue and bring the database back into a consistent state.

NPE when trying to import OpenAPI 3.0 spec without given servers

API-Mgr. CLI version
1.1.0

API-Manager and Service-Pack Version
7.7-March

Expected behavior
Import OpenAPI 3.0.1 specification without having servers defined by using backendBasepath instruction in config file.

Actual behavior
A NullPointerException appears when trying to setup the given backendBasepath in OpenAPI 3.0 file:

Log-Output in Debug

790    ERROR     APISpecification| Cannot replace host in provided Swagger-File. Continue with given host.
java.lang.NullPointerException
        at com.axway.apim.api.definition.OAS3xSpecification.configureBasepath(OAS3xSpecification.java:37)
        at com.axway.apim.api.definition.OAS3xSpecification.configure(OAS3xSpecification.java:55)
        at com.axway.apim.api.definition.APISpecificationFactory.getAPISpecification(APISpecificationFactory.java:44)
        at com.axway.apim.api.definition.APISpecificationFactory.getAPISpecification(APISpecificationFactory.java:28)
        at com.axway.apim.apiimport.APIImportConfigAdapter.getDesiredAPI(APIImportConfigAdapter.java:222)
        at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:68)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:142)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:78)

[Bug] NullPointerException during export using -wide option

API-Mgr. CLI version
1.1.0

API-Manager and Service-Pack Version
7.6.2 SP4

Expected behavior

Actual behavior
If I run an export like "apim api get -s -wide" I get the stacktrace below.

Log-Output in Debug
java.lang.NullPointerException
at com.axway.apim.api.export.impl.APIResultHandler.getUsedSecurity(APIResultHandler.java:140)
at com.axway.apim.api.export.impl.ConsoleAPIExporter.lambda$printWide$11(ConsoleAPIExporter.java:64)
at com.github.freva.asciitable.ColumnData.getCellValue(ColumnData.java:15)
at com.github.freva.asciitable.AsciiTable.lambda$null$0(AsciiTable.java:40)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:545)
at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:438)
at com.github.freva.asciitable.AsciiTable.lambda$getTable$2(AsciiTable.java:41)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:545)
at java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
at java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:438)
at com.github.freva.asciitable.AsciiTable.getTable(AsciiTable.java:42)
at com.axway.apim.api.export.impl.ConsoleAPIExporter.printWide(ConsoleAPIExporter.java:56)
at com.axway.apim.api.export.impl.ConsoleAPIExporter.execute(ConsoleAPIExporter.java:37)
at com.axway.apim.APIExportApp.runExport(APIExportApp.java:113)
at com.axway.apim.APIExportApp.export(APIExportApp.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:138)
at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:76)

Test case sample

Please describe the steps you have done to replicate the issue

Error creating/updating organization

API-Mgr. CLI version
1.2.1

API-Manager and Service-Pack Version
7.6.2 SP2

Expected behavior
I tried the new feature to import organizations, I tried with a simple json file like this:

{
"name" : "API Development 6425",
"description" : "Test Org 6425 test",
"restricted" : false,
"enabled" : true,
"development" : true,
"createdOn" : 1593700799104
}

I run apim-cli and the organization is correctly created.
Then I modified the description field in json file and I launched again the tool. I expected that the description in my organization is updated and the tool return a success status code.

Actual behavior
The strange thing is that the description is effectively updated but the api call (put on organization id) returns a 404 status and so an exception is thrown (see log below). It seems that the PUT call on the specific organization must contain all the fields of the organization (see my ticket to axway support #01190568).

Log-Output in Debug

2020-09-04 13:25:41,497 DEBUG              headers| http-outgoing-3 >> PUT /api/portal/v1.3/organizations/44478fbe-4e75-4b38-9b7e-a67ac1198269 HTTP/1.1
2020-09-04 13:25:41,519 DEBUG              headers| http-outgoing-3 >> Content-type: application/json
2020-09-04 13:25:41,524 DEBUG              headers| http-outgoing-3 >> CSRF-Token: A5963742B05663825171817DB3A0DFFCA27B3F13E568BE7395B536FCA7B887AE
2020-09-04 13:25:41,524 DEBUG              headers| http-outgoing-3 >> Content-Length: 145
2020-09-04 13:25:41,543 DEBUG              headers| http-outgoing-3 >> Host: 192.168.2.43:8075
2020-09-04 13:25:41,563 DEBUG              headers| http-outgoing-3 >> Connection: Keep-Alive
2020-09-04 13:25:41,569 DEBUG              headers| http-outgoing-3 >> User-Agent: Apache-HttpClient/4.5.12 (Java/1.8.0_261)
2020-09-04 13:25:41,587 DEBUG              headers| http-outgoing-3 >> Cookie: APIMANAGERSESSION=0c089bd8-4816-4fad-a14c-6480f2ac53b7; APIMANAGERSTATIC=0729a9b5-4a71-45ea-966e-ba9e337da826
2020-09-04 13:25:41,594 DEBUG              headers| http-outgoing-3 >> Accept-Encoding: gzip,deflate
2020-09-04 13:25:41,595 DEBUG                 wire| http-outgoing-3 >> "PUT /api/portal/v1.3/organizations/44478fbe-4e75-4b38-9b7e-a67ac1198269 HTTP/1.1[\r][\n]"
2020-09-04 13:25:41,613 DEBUG                 wire| http-outgoing-3 >> "Content-type: application/json[\r][\n]"
2020-09-04 13:25:41,633 DEBUG                 wire| http-outgoing-3 >> "CSRF-Token: A5963742B05663825171817DB3A0DFFCA27B3F13E568BE7395B536FCA7B887AE[\r][\n]"
2020-09-04 13:25:41,638 DEBUG                 wire| http-outgoing-3 >> "Content-Length: 145[\r][\n]"
2020-09-04 13:25:41,638 DEBUG                 wire| http-outgoing-3 >> "Host: 192.168.2.43:8075[\r][\n]"
2020-09-04 13:25:41,656 DEBUG                 wire| http-outgoing-3 >> "Connection: Keep-Alive[\r][\n]"
2020-09-04 13:25:41,662 DEBUG                 wire| http-outgoing-3 >> "User-Agent: Apache-HttpClient/4.5.12 (Java/1.8.0_261)[\r][\n]"
2020-09-04 13:25:41,662 DEBUG                 wire| http-outgoing-3 >> "Cookie: APIMANAGERSESSION=0c089bd8-4816-4fad-a14c-6480f2ac53b7; APIMANAGERSTATIC=0729a9b5-4a71-45ea-966e-ba9e337da826[\r][\n]"
2020-09-04 13:25:41,680 DEBUG                 wire| http-outgoing-3 >> "Accept-Encoding: gzip,deflate[\r][\n]"
2020-09-04 13:25:41,699 DEBUG                 wire| http-outgoing-3 >> "[\r][\n]"
2020-09-04 13:25:41,703 DEBUG                 wire| http-outgoing-3 >> "{"name":"API Development 6425","description":"Test Org 6425 test","restricted":false,"enabled":true,"development":true,"createdOn":1593700799104}"
2020-09-04 13:25:41,861 DEBUG                 wire| http-outgoing-3 << "HTTP/1.1 404 Not Found[\r][\n]"
2020-09-04 13:25:41,861 DEBUG                 wire| http-outgoing-3 << "Date: Fri, 04 Sep 2020 11:25:41 GMT[\r][\n]"
2020-09-04 13:25:41,865 DEBUG                 wire| http-outgoing-3 << "Content-Type: application/json[\r][\n]"
2020-09-04 13:25:41,880 DEBUG                 wire| http-outgoing-3 << "Server: Gateway[\r][\n]"
2020-09-04 13:25:41,884 DEBUG                 wire| http-outgoing-3 << "Connection: close[\r][\n]"
2020-09-04 13:25:41,899 DEBUG                 wire| http-outgoing-3 << "X-CorrelationID: Id-3524525f33039563125ed3af 0[\r][\n]"
2020-09-04 13:25:41,903 DEBUG                 wire| http-outgoing-3 << "[\r][\n]"
2020-09-04 13:25:41,903 DEBUG                 wire| http-outgoing-3 << "{"errors":[{"code":102,"message":"Not Found"}]}"
2020-09-04 13:25:41,922 DEBUG              headers| http-outgoing-3 << HTTP/1.1 404 Not Found
2020-09-04 13:25:41,929 DEBUG              headers| http-outgoing-3 << Date: Fri, 04 Sep 2020 11:25:41 GMT
2020-09-04 13:25:41,930 DEBUG              headers| http-outgoing-3 << Content-Type: application/json
2020-09-04 13:25:41,949 DEBUG              headers| http-outgoing-3 << Server: Gateway
2020-09-04 13:25:41,956 DEBUG              headers| http-outgoing-3 << Connection: close
2020-09-04 13:25:41,974 DEBUG              headers| http-outgoing-3 << X-CorrelationID: Id-3524525f33039563125ed3af 0
2020-09-04 13:25:41,977 DEBUG                 wire| http-outgoing-3 << "end of stream"
2020-09-04 13:25:41,978 DEBUG HttpClientConnection| http-outgoing-3: Close connection
2020-09-04 13:25:41,996 DEBUG       MainClientExec| Connection discarded
2020-09-04 13:25:42,000 DEBUG entConnectionManager| Connection released: [id: 3][route: {s}->https://192.168.2.43:8075][total available: 0; route allocated: 0 of 2; total allocated: 0 of 5]
2020-09-04 13:25:42,018 ERROR rOrganizationAdapter| Error creating/updating organization. Response-Code: 404. Got response: '{"errors":[{"code":102,"message":"Not Found"}]}'
2020-09-04 13:25:42,023 ERROR   OrganizationCLIApp| Error creating/updating organization
com.axway.apim.lib.errorHandling.AppException: Error creating/updating organization
        at com.axway.apim.adapter.apis.APIManagerOrganizationAdapter.createOrUpdateOrganization(APIManagerOrganizationAdapter.java:164)
        at com.axway.apim.adapter.apis.APIManagerOrganizationAdapter.updateOrganization(APIManagerOrganizationAdapter.java:112)
        at com.axway.apim.organization.OrganizationImportManager.replicate(OrganizationImportManager.java:33)
        at com.axway.apim.organization.OrganizationCLIApp.importOrganization(OrganizationCLIApp.java:148)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:142)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:78)
Caused by: com.axway.apim.lib.errorHandling.AppException: Error creating/updating organization.
        at com.axway.apim.adapter.apis.APIManagerOrganizationAdapter.createOrUpdateOrganization(APIManagerOrganizationAdapter.java:153)
        ... 9 more
Caused by: com.axway.apim.lib.errorHandling.AppException: Error creating/updating organization. Response-Code: 404
        at com.axway.apim.adapter.apis.APIManagerOrganizationAdapter.createOrUpdateOrganization(APIManagerOrganizationAdapter.java:149)
        ... 9 more

Test case sample
SEE Expected behaviour

[Bug] NullPointerException with -credential option

API-Mgr. CLI version
1.2.1

API-Manager and Service-Pack Version
7.6.2 SP4

Expected behavior

Actual behavior
If I run the following command, a NullPointerException happens.
apim app get -s <myStage> -credential <myCredential>

Log-Output in Debug

----------------------------------------------------------------------------------------
API-Manager CLI: 1.2.1

To report issues or get help, please visit:
https://github.com/Axway-API-Management-Plus/apim-cli
----------------------------------------------------------------------------------------
Module: Application - E X P O R T / U T I L S (1.2.1)
----------------------------------------------------------------------------------------
4659   INFO     APIManagerAdapter| Successfully connected to API-Manager (7.6.2 SP4) on: https://...:8075
30036  ERROR ApplicationExportApp| Can't initialize API-Manager API-Representation.
com.axway.apim.lib.errorHandling.AppException: Can't initialize API-Manager API-Representation.
        at com.axway.apim.adapter.clientApps.APIMgrAppsAdapter.getApplications(APIMgrAppsAdapter.java:146)
        at com.axway.apim.appexport.ApplicationExportApp.runExport(ApplicationExportApp.java:87)
        at com.axway.apim.appexport.ApplicationExportApp.export(ApplicationExportApp.java:56)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:142)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:78)
Caused by: java.lang.NullPointerException
        at java.util.regex.Matcher.getTextLength(Matcher.java:1283)
        at java.util.regex.Matcher.reset(Matcher.java:309)
        at java.util.regex.Matcher.<init>(Matcher.java:229)
        at java.util.regex.Pattern.matcher(Pattern.java:1093)
        at com.axway.apim.adapter.clientApps.ClientAppFilter.filterCredential(ClientAppFilter.java:221)
        at com.axway.apim.adapter.clientApps.ClientAppFilter.filter(ClientAppFilter.java:207)
        at com.axway.apim.adapter.clientApps.APIMgrAppsAdapter.getApplications(APIMgrAppsAdapter.java:140)
        ... 8 more

Test case sample

Please describe the steps you have done to replicate the issue

Incorrect exit RC being returned from the apim script ?

API-Mgr. CLI version
1.1.0

API-Manager and Service-Pack Version

7.6.2/SP3
Expected behavior
In case there is an exception, return code from the script should be not equal =0

Actual behavior
If we are passing incorrect password to the script, we are getting an exception. Still the RC returned from the script =0.
Because of this , Jenkins pipeline job is always successful even though it caught an exception.

Can you please confirm if this is an issue or is this how it was intended to behave ?

Log-Output in Debug

Test case sample

Please describe the steps you have done to replicate the issue

Passed incorrect API Manager password to the script. See below stack trace outout:

----------------------------------------------------------------------------------------
API-Manager CLI: 1.1.0

To report issues or get help, please visit:
https://github.com/Axway-API-Management-Plus/apim-cli
----------------------------------------------------------------------------------------
Module: API - I M P O R T (1.1.0)
----------------------------------------------------------------------------------------
0      WARN     APIManagerAdapter| Login failed with statusCode: 403. Got response: '{"errors":[{"code":403,"message":"Invalid user or password"}]}' ... Try again in 1 second.
1491   ERROR    APIManagerAdapter| Login finally failed with statusCode: 403. Got response: '{"errors":[{"code":403,"message":"Invalid user or password"}]}' Got response: '{"errors":[{"code":403,"message":"Invalid user or password"}]}'
1496   ERROR         APIImportApp| Can't login to API-Manager
com.axway.apim.lib.errorHandling.AppException: Can't login to API-Manager
        at com.axway.apim.adapter.APIManagerAdapter.loginToAPIManager(APIManagerAdapter.java:231)
        at com.axway.apim.adapter.APIManagerAdapter.<init>(APIManagerAdapter.java:172)
        at com.axway.apim.adapter.APIManagerAdapter.getInstance(APIManagerAdapter.java:133)
        at com.axway.apim.APIImportApp.importAPI(APIImportApp.java:63)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:138)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:76)
Caused by: com.axway.apim.lib.errorHandling.AppException: Login finally failed with statusCode: 403
        at com.axway.apim.adapter.APIManagerAdapter.loginToAPIManager(APIManagerAdapter.java:213)
        ... 9 more

[Feature] Init caches on demand to improve CLI startup time

User story
Actually the tool is initializing during start all caches, no matter if they are used for command or not. This takes a few seconds for nothing.
Instead the caches should be initialized lazy to improve the start-time and user-experience.

[BUG] Wrong info text during deletion of an unpublished API proxy

API-Mgr. CLI version
1.0.1

API-Manager and Service-Pack Version
7.6.2. SP4

Expected behavior
As OrgAdmin, if I delete an existing unpublished API proxy I get the following two lines of info which are wrong, because the API proxy was deleted successfully.

  • Successfully updated deleted API
  • Actual API has been created and is waiting for an approval by an administrator. You may update the pending API as often as you want before it is finally published.

Actual behavior

Log-Output in Debug
2014 INFO UpdateExistingAPI| Waiting for approval ... Successfully updated deleted API: 'Petstore API' 1.0.5 (ID: 61c80aae-d3bd-412b-a3f3-5bd2c9694f42)
2015 INFO APIImportManager| Actual API has been created and is waiting for an approval by an administrator. You may update the pending API as often as you

Test case sample

Please describe the steps you have done to replicate the issue

apim-cli.bat not working when JAVA_HOME is not set, but there is java installed

API-Mgr. CLI version

Please make sure to use the latest available version before reporting a bug.
Version 1.2.1

API-Manager and Service-Pack Version
No need, I just trying to run the .\apim-cli.bat and it can't find java.

Expected behavior
The apim-cli.bat starts and returns the help.

Actual behavior
It returns:
'-Xms64m' is not recognized as an internal or external command,
operable program or batch file.

Log-Output in Debug

Test case sample

Please describe the steps you have done to replicate the issue
What I noticed is that it does not find the JAVA_HOME, but it detects that there is a javaFound, so it tries to set the variable _java to java (I can run java on the command prompt, or on the PowerShell just fine), but the SET _java=java is not working (after that I put an echo for the %_java% and it is printing empty...

I tested this on the command prompt on the Windows Server 2008 R2 and on its PowerShell. John Wiese also looked into it with me on his Windows 10 machine and same behavior.

Thanks, Luiz ([email protected])

apim app get -o csv -t xxxx will not generate the csv formatted output

API-Mgr. CLI version
Module: API - E X P O R T / U T I L S (1.2.1)

API-Manager and Service-Pack Version
API-Manager (7.6.2)

Expected behavior
csv format

Actual behavior
The default console output format is used, instead of writing the result to a csv file.

Log-Output in Debug

Test case sample
I ran apim app get -o csv with or without the --target option. The result is always the default console output.
Please note, apim api get -o csv -t xxxx works fine.

[BUG] NullPointerException during App export

API-Mgr. CLI version
1.0.0

API-Manager and Service-Pack Version
7.6.2 SP4

Expected behavior

Actual behavior
As OrgAdmin, as NullPointerException happens with the following call
apim app get -s <myStage>-ultra

Log-Output in Debug

2156   INFO     APIManagerAdapter| Successfully connected to API-Manager (7.6.2 SP4) on: ...
2303   WARN  rOrganizationAdapter| Using OrgAdmin only to load all organizations.
2364   ERROR ApplicationExportApp| Can't initialize API-Manager API-Representation.
com.axway.apim.lib.errorHandling.AppException: Can't initialize API-Manager API-Representation.
        at com.axway.apim.adapter.clientApps.APIMgrAppsAdapter.getApplications(APIMgrAppsAdapter.java:143)
        at com.axway.apim.appexport.ApplicationExportApp.runExport(ApplicationExportApp.java:76)
        at com.axway.apim.appexport.ApplicationExportApp.export(ApplicationExportApp.java:55)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.axway.apim.cli.APIManagerCLI.run(APIManagerCLI.java:138)
        at com.axway.apim.cli.APIManagerCLI.main(APIManagerCLI.java:76)
Caused by: java.lang.NullPointerException
        at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:889)
        at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3005)
        at com.axway.apim.adapter.apis.APIManagerQuotaAdapter.getQuotaForAPI(APIManagerQuotaAdapter.java:103)
        at com.axway.apim.adapter.clientApps.APIMgrAppsAdapter.getApplications(APIMgrAppsAdapter.java:135)
        ... 8 more

Outbound Method override not working

API-Mgr. CLI version
1.2.0

API-Manager and Service-Pack Version
7.6.2 SP4

Expected behavior
When configuring a method override in the "Outbound" section like so:

  "outboundProfiles" : {
    "_default" : {
      "routeType" : "proxy",
      "authenticationProfile" : "_default"
    },
    "deleteOrder" : {
      "routeType" : "proxy",
      "requestPolicy" : "Request policy 1"
    }
  },

The API is successfully replicated but when reviewing that API in the UI is shows the following error (in 7.6.2 SP4):
image

See issue #39 for more details.

[Feature] Display detail information on console when result-set is 1

User story
When getting APIs or Applications with the following command:
apim get api -s api-env
I only get the summary/list information:

+--------------------------------------+-----------------------+------------------------------+---------+
| API-Id                               | Path                  | Name                         | Version |
+--------------------------------------+-----------------------+------------------------------+---------+
| 14295903-2583-430a-8e5b-fda415191639 | /api/hipaa/control    | Security-HIPAA-Control       |     1.0 |

But as we have only ONE result it is convenient to display additional information like the following:

Organization: Organization ABC
Created On: <Date>
Created By: <Date>
Granted Organizations: <List of org-names>
Subscribed applications: <List of Application names>
Custom-Policies: <List of policy names>
Tags: <List of Tag-Groups<List of Tags>>
Custom-Properties: <List of Key: Value pairs>

There might be more information for an API we may add.

Additional context
This requires to load additional information for that API from the API-Manager Adapter ad-hoc.

CSRF token issue with HAProxy

API-Mgr. CLI version
1.2.1

API-Manager and Service-Pack Version
7.7.20200730

Expected behavior
CSRF token is recognized and handled

Actual behavior
CSRF token returned from APIM through HAProxy is ignored

The problem is that HAProxy returns headers in lowercase and https://github.com/Axway-API-Management-Plus/apim-cli/blob/develop/modules/apim-adapter/src/main/java/com/axway/apim/adapter/APIManagerAdapter.java#L312 do a case-sensitive look up for "CSRF-Token".

As http headers are case-insensitive (https://tools.ietf.org/html/rfc7230#section-3.2), the above should probably be

			if(header.getName().equalsIgnoreCase("csrf-token")) {

apim-cli.sh not working when JAVA_HOME doesn't exist

API-Mgr. CLI version
Version 1.2.1

Please make sure to use the latest available version before reporting a bug.

API-Manager and Service-Pack Version
N/A

Expected behavior
Run the shell script with the command usage if you type ./apim-cli.sh

Actual behavior
Error: Could not find or load main class com.axway.apim.cli.APIManagerCLI

Log-Output in Debug

Test case sample

Please describe the steps you have done to replicate the issue

I fixed it by adding/changing the lines after programDir variable declaration:
baseClassDir="$programDir/.."
cd $baseClassDir

CP=$baseClassDir/lib:$baseClassDir/conf
for jars in lib/*
do
CP=$CP:$baseClassDir/$jars
done

This case, the classes are not relative anymore, but absolute, thus not having issues to find the main class any longer. Feel free to change to whatever you like as well, as you can have other limitations/constraints/standards in mind.

Thanks, Luiz

[BUG] Output folder is empty

API-Mgr. CLI version

Please make sure to use the latest available version before reporting a bug.

API-Manager and Service-Pack Version

7.6.2, SP3
Expected behavior
Should be able to export the api;s.

Actual behavior
target folder is empty,

Log-Output in Debug

target folder is empty,

Test case sample

Please describe the steps you have done to replicate the issue
I am able to see the exported API's on the terminal, but the target folder is empty after running this command : apim api get -s dev --output json -t C:/axway/apis

[Feature] Default values for a Security Profile

User story

To integrate Swagger-Promote into our CI/CD pipeline we would like to have the ability
to define defaults for security profiles.

Additional context

This would allow us to define defaults for certain security profiles so that API Developers don't have to specify the full configuration of the security profile.

For example, an API Developer would only need to specify the OAuth scope needed to protect their API. The rest would be specified in some default file. So, I could have an oauth_external.default.json file with the following because I want every API using OAuth (External) to have a standard config:

{
    "type": "oauthExternal",
    "name": "OAuth (External)",
    "order": 1,
    "properties": {
        "tokenStore": "JWT",
        "accessTokenLocation": "HEADER",
        "authorizationHeaderPrefix": "Bearer",
        "scopesMustMatch": "Any",
        "removeCredentialsOnSuccess": "false",
        "useClientRegistry": true,
        "subjectSelector": "${oauth.token.client_id}",
        "implicitGrantEnabled": true,
        "implicitGrantLoginEndpointUrl": "https://localhost:8089/api/oauth/authorize",
        "implicitGrantLoginTokenName": "access_token",
        "authCodeGrantTypeEnabled": true,
        "authCodeGrantTypeRequestEndpointUrl": "https://localhost:8089/api/oauth/authorize",
        "authCodeGrantTypeRequestClientIdName": "client_id",
        "authCodeGrantTypeRequestSecretName": "client_secret",
        "authCodeGrantTypeTokenEndpointUrl": "https://localhost:8089/api/oauth/token",
        "authCodeGrantTypeTokenEndpointTokenName": "access_code"
    }
}

Then, the API Developer would only need to specify something like this in their API config file:

"securityProfiles": [
    {
        "type": "oauthExternal",
        "name": "_default",
        "isDefault": true,
        "properties": {
            "scopes": "read:pets"
        }
    }
]

The tool would use the default config for type oauthExternal and add the scope property to it. I believe this would be a huge benefit to any organization. This way, I can put some controls around how all APIs should be configured and also reduce the complexity of the config file for the developer.

[Feature] REST-API - Swagger-Promote as a Service

User story
The requirement is to have Swagger-Promote running as a service in front of each API-Manager instead of running it individually for each API. With that, new options would be possible as basically every REST-Client can easily promote/replicate an API into the API-Manager.

With that the following issues will be solved:

  • Axway-API-Management-Plus/apimanager-swagger-promote#144
  • Axway-API-Management-Plus/apimanager-swagger-promote#143

Additional context
Has been prototyped during the API-Management Hackathon in Paris. See here:
https://github.com/axwayhackathon/apimanager-swagger-promote

New operation to change BackendBasepath of a published API

User story
The CLI should support to change the current backend basepath of a published API, without the need to export the API and importing it again. A command like so:

apim api change -s api-env <FILTER_API_AS_YOU_LIKE> -oldBackend http://old.server.com/... -newBackend https://new.server.com/API

When doing so, all belonging API-Configuration, such as granted API-Access, subscribed applications, quotas need to stay as before.
This must be performed without any downtime.
The parameter: -oldBackend is optional and when given used to validate the existing backend before updating to the new.
This operation should support batch processing to update multiple selected APIs in one step.

In general the change command will support other actions later, such as changing policies, tags, etc.

Additional context
This is for instance required when an application is moving from a On-Premise environment into the Cloud.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.