3

while exporting API, getting below error. Please suggest.

G:\WSO2\apimcli>apimcli export-api -n PizzaShackAPI -v 1.0.0 -r admin -e dev -k

apimcli: Error while exporting Reason: Get https://localhost:9443/carbon/admin/login.jsp: Auto redirect is disabled
Exit status 1

G:\WSO2\apimcli>apimcli export-api -n PizzaShackAPI -v 1.0.0 -r admin -e dev

apimcli: Error while exporting Reason: Get https://localhost:9443/api-import-export-2.6.0-v0/export-api?name=PizzaShackAPI&preserveStatus=true&provider=admin&version=1.0.0: x509: certificate signed by unknown authority
Exit status 1
Bee
  • 12,251
  • 11
  • 46
  • 73
RaviKumar
  • 163
  • 11

3 Answers3

0

Make sure you deployed the same version of api-import-export war which you configured in the add environment command[1].

apimcli add-env -n production \
         --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-v10 \
         --admin https://localhost:9443/api/am/admin/v0.14 \
         --api_list https://localhost:9443/api/am/publisher/v0.14/apis \
         --app_list https://localhost:9443/api/am/store/v0.14/applications

In above case, it's api-import-export-2.6.0-v10.

[1] https://docs.wso2.com/display/AM260/Migrating+the+APIs+and+Applications+to+a+Different+Environment#Example-AddEnv

Bee
  • 12,251
  • 11
  • 46
  • 73
  • Tried api-import-export war 2.6.0 where as it is throwing an error while deploying, I tried older version 2.5.0 exporting has worked fine, but if I try to import the same exported file it is causing an error, can you please let me know if there are is solution for this. apimcli: Error importing API Reason: C:\PizzaShackAPI-1.0.0\Docs\docs.json\Meta-information\api was not found as a YAML or JSON Exit status 1 the file which was created inside .Zip is consists of .json file but it is still showing an as not found – RaviKumar Sep 03 '19 at 13:05
  • You shouldn't use 2.5.0 war with 2.6.0 server. What's the deployment error you get with 2.6.0 war? – Bee Sep 03 '19 at 19:14
  • ERROR - ContainerBase ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api-import-export-2.6.0-v10]] ERROR - CarbonTomcat Webapp StandardEngine[Catalina].StandardHost[localhost].StandardContext[/api-import-export-2.6.0-v10] failed to deploy – RaviKumar Sep 04 '19 at 05:15
  • https://stackoverflow.com/questions/57621563/migrating-the-wso2-apis-and-applications-to-a-different-environment – RaviKumar Sep 05 '19 at 10:54
  • Deployed 2.6.0 war with 2.6.0 server, even Importing of an API making some errors. cmd used: >apimcli import-api -f G:/Petstore_1.0.0.zip -e dev Error : \Petstore_1.0.0\Meta-information\api was not found as a YAML or JSON Exit status 1 – RaviKumar Sep 06 '19 at 05:14
  • Yes.. It worked fine.. but stuck with Importing https://stackoverflow.com/questions/57816530/importing-migrating-an-api-from-local-repo-environment-to-other-environment – RaviKumar Sep 06 '19 at 06:40
0

You should create Self Signed Certificates and add them .jks file in G:\WSO2\wso2am-2.6.0\repository\resources\security\client-truststore.jks. It worked..

This how to Create Self Signed Certificates: http://niranjankaru.blogspot.com/2016/01/create-your-own-ssl-certificate-for.html

RaviKumar
  • 163
  • 11
0

I have sorted out the issue in my case as version compatibility among apimcli, import/export war file and WSO2 API-M server.

Issue was occurred due to the version (api-import-export-2.6.0-v10) mentioned as compatible by WSO2 not working properly with our APIM server and tried lowering the version and worked properly now.

WSO2 API-M version: 2.6.0 Import/Export tool version: APIMCLI v2.0.1 [Zip file downloaded for apimcli is ready for use no additional config was needed in my case] Import/Export WAR file version: api-import-export-2.5.0-v1 [war file has been hot deployed to below path wso2am/2.6.0/repository/deployment/server/webapps/]

Below Commands executed:

Exported an already created API from DEV environment: *$ ./apimcli export-api -n ProfileManagementNJ -v v1.0.0 -r admin -e dev -k

Successfully exported API! Find the exported API at /home/stwso2/.wso2apimcli/exported/apis/dev/ProfileManagementNJ_v1.0.0.zip*

Imported the above exported API to ST environment: *$ ./apimcli import-api -k -f /home/stwso2/.wso2apimcli/exported/apis/dev/ProfileManagementNJ_v1.0.0.zip -e st --preserve-provider false

Successfully imported API*

Actual error message details can be found as in below and are captured from console log: $ ./apimcli export-api -n ProfileManagementNJ -v 1.0.0 -r admin -e st -k --verbose

Executed ImportExportCLI (apimcli) on Wed, 30 Oct 2019 13:41:52 UTC

[INFO]: Insecure: true

[INFO]: export-api called

[INFO]: ExportAPI: URL: https://172.26.41.4:9443/api-import-export-2.6.0-v10/export-api?name=ProfileManagementNJ&version=1.0.0&provider=admin&preserveStatus=true

apimcli: Error while exporting Reason: Get https://172.26.41.4:9443/carbon/admin/login.jsp: Auto redirect is disabled

Exit status 1

source: https://docs.wso2.com/display/AM260/Migrating+the+APIs+to+a+Different+Environment#Example-exportAPI