-
Notifications
You must be signed in to change notification settings - Fork 20
Description
APIM-CLI version
1.14.11
API-Management version
7.7.20240530
Bug description
Description:
When running a command like:
apim api get -s api-env -o json -t ./apis -ultra
...to export multiple APIs (either all or a filtered subset), each API is placed in a separate folder based on its defined path in API Manager.
However, consider the following valid use case:
In API Manager, it's possible to have multiple APIs with the same path (e.g., /petstore/v2) under different virtual hosts or using query string versioning (when the setting "Enable query string version routing" is enabled), allowing version selection via something like /petstore?v=2.
In such cases, apim-cli does export all the APIs, but since the configuration file name (api-config.json) and potentially the certificate file names are the same for each, the second API export will overwrite the files from the first one within the same folder (e.g., petstore-v2).
This causes a problem when performing tasks like environment migration or bulk promotion between environments, where having both configurations preserved is critical. After the export, only the latest API (the one exported last) remains valid, and during re-import, only that API will be recreated in the target API Manager, since there's only one api-config.json.
Suggested behavior:
If multiple APIs share the same path, the CLI should detect this and generate a unique directory name for each one (e.g., appending the API ID or version to the directory name), so that each API is exported in its own folder and can later be imported individually without conflicts.
This would improve reliability in bulk operations and make the tool more robust in common enterprise scenarios.
Steps to reproduce
No response
