0

i'm trying to export api from wso2 apim using apictl and while exporting the api it prints error in the log

PS C:\WINDOWS\system32> apictl login dev -u admin -p admin --insecure
Warning: Using --password in CLI is not secure. Use --password-stdin
Logged into APIM in dev environment
WARNING: credentials are stored as a plain text in C:\Users\youssef.gamal\.wso2apictl.local\keys.json
PS C:\WINDOWS\system32> apictl export api --name GenericCso --version 1.0.0 --environment dev --verbose
Executed ImportExportCLI (apictl) on Wed, 03 Jul 2024 19:49:01 EET
[INFO]: Insecure: false
[INFO]: api called
[INFO]: connecting to https://localhost:9943/oauth2/token
[INFO]: ExportAPI: URL: https://localhost:9943/publisher/apis/api/am/publisher/v3/apis/export?name=GenericCso&version=1.0.0&providerName=&preserveStatus=true&format=YAML
[INFO]: ResponseStatus: 200
[INFO]: Extracting C:\Users\YOUSSE~1.GAM\AppData\Local\Temp\apim644902823\GenericCso_1.0.0.zip to C:\Users\YOUSSE~1.GAM\AppData\Local\Temp\apim198201050
apictl: Error creating the final zip archive Reason: Stat : The system cannot find the path specified.
Exit status 1
PS C:\WINDOWS\system32> apictl get envs
NAME                API MANAGER ENDPOINT     REGISTRATION ENDPOINT   TOKEN ENDPOINT                        PUBLISHER ENDPOINT                      DEVPORTAL ENDPOINT   ADMIN ENDPOINT      MI MANAGEMENT ENDPOINT
dev                 https://localhost:9943                           https://localhost:9943/oauth2/token   https://localhost:9943/publisher/apis                            
PS C:\WINDOWS\system32>

i'm have tried AI solutions as chat-gpt but not working for me

3
  • May I know whether you're trying this in an RDP machine? Commented Jul 12 at 2:23
  • Pls try setting up export-directory with r/w permissions and then run the command.
    – k10gaurav
    Commented Jul 12 at 6:35
  • How can i set permission to the directly, cause apitcl tool creates a folder dynamically each run for the command ? Commented Jul 12 at 14:36

1 Answer 1

0

It can be an issue related to the environment setting up. Can you add the environment as below?

apictl add env dev --apim https://localhost:9943 -k

Before adding this you have to remove the existing environment with the name dev.

apictl remove env dev
3
  • I'm currently running my APIM on port 9643 and I tried first to delete the dev env then i runned your command Commented Jul 7 at 14:22
  • PS C:\WINDOWS\system32> apictl add env dev --apim localhost:9643 -k Default token endpoint 'localhost:9643/oauth2/token' is added as the token endpoint Successfully added environment 'dev' Commented Jul 7 at 14:22
  • and when i try to export the api, i found 404 error PS C:\WINDOWS\system32> apictl export api --name GenericCso --version 1.0.0 --environment dev --verbose Executed ImportExportCLI (apictl) on Sun, 07 Jul 2024 17:17:50 EET [INFO]: Insecure: false [INFO]: api called [INFO]: connecting to localhost:9643/oauth2/token [INFO]: ExportAPI: URL: localhost:9643/api/am/publisher/v3/apis/… [INFO]: ResponseStatus: 404 Error exporting API: 404 Commented Jul 7 at 17:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.