Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[APIMCLI] Export APIs fail for APIs that has white spaces in API name #3012

Open
dilshanfardil opened this issue Jul 19, 2024 · 0 comments
Open

Comments

@dilshanfardil
Copy link

Description

While using APIM 2.6.0 version and they have some APIs which has white spaces in API names. In APIM 2.6.0(U2 level 61) having spaces in APIs was possible when creating through publisher APIs.

When they are trying to export APIs using APIMCLI using the below command they are getting below 400 error response for the APIs that has spaces in the API name.

Command:
./apimcli export-apis -e prod2 --ignore-swagger-definition=true --verbose -k

Logs:

Executed ImportExportCLI (apimcli) on Fri, 28 Jun 2024 12:59:09 +0530
[INFO]: Insecure: true
[INFO]: export-apis called
Login to prod2
Username:admin
Password:
Getting ClientID, ClientSecret: Status - 200 OK
Logged into prod2 environment
WARNING: credentials are stored as a plain text in /Users/imedya/.wso2apimcli/keys.json


Exporting APIs for the migration...
Cleaning all the previously exported APIs of the given target tenant, in the given environment if any, and prepare to export APIs from beginning
[INFO]: connecting to https://localhost:8243/token
[INFO]: URL: https://localhost:9443/api/am/publisher/v0.14/apis?limit=20&offset=0
[INFO]: Response: 200 OK
Found  7 of APIs to be exported in the iteration beginning with the offset #0. Maximum limit of APIs exported in single iteration is 20
[INFO]: ExportAPI: URL: https://localhost:9443/api-import-export-2.6.0-v19/export-api?name=mypetadmin API&version=1.0.0&provider=admin&preserveStatus=true&ignoreSwagger=true
Error exporting API: mypetadmin API - 1.0.0  of Provider: admin

Response Status: 400 Bad Request.

Response :
Response Headers: map[Date:[Fri, 28 Jun 2024 07:29:16 GMT] Server:[WSO2 Carbon Server]]
Response Time:34.7325ms
Response Received At:2024-06-28 12:59:16.474766 +0530 +0530 m=+6.740245334Exit status 1

APIMCLI version: apimcli-2.0.16
WSO2 API import/export tool: api-import-export-2.6.0-v19.war

Steps to Reproduce

  1. Get an APIM-2.6.0 pack to U2 level 61 and using publisher rest API[2] deploy an API with a space in the API name. Use the payload.json. (You can get the Postman collection from here https://api.postman.com/collections/13953519-463a4719-f41b-42fb-ace2-ecc3e7e3d3de?access_key=PMAT-01J1EXXMHTXN3351W8HR9FK5DF)

  2. Set up the CLI environment and add the current environment using the below command

./apimcli add-env -n prod2 \
                      --registration https://localhost:9443/client-registration/v0.14/register \
                      --apim https://localhost:9443 \
                      --token https://localhost:8243/token \
                      --import-export https://localhost:9443/api-import-export-2.6.0-v19
  1. Then run the export command as below;

./apimcli export-apis -e prod2 --ignore-swagger-definition=true --verbose -k

You will observe the 400 bad request response for the API which has space in the API name.

Affected Component

APIM

Version

2.6.0

Environment Details (with versions)

No response

Relevant Log Output

No response

Related Issues

No response

Suggested Labels

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant