0

I tried Download api in wso2 apim publisher and apictl tool of wso2 apim, but in both conditions export is not complete, I have made changes in policies and Resources and other parts but the information is not exist in exported files. is there any solution to export an API in wso2 api manager completely?

2 Answers2

1

When you export an API with apictl, you have two options. Either you can export the current version of the API or you can export a specific revision.

In the export API command, if you did not specify the revision number, it will export the current version of the API without deployment information. As deployments are tightly coupled with the revision, this information will be exported if you exported an revision explicitly.

apictl export api -n StoreAPI -v 1.0.0 -r Alice -e dev will export the current version of the API. This will include all the changes that you have applied even if the API is not revisioned. apictl export api -n PizzaShackAPI -v 1.0.0 --rev 1 -r admin -e dev will export the revision 1 of the same API. Changes done after the revision creation will not be included in the exported artifact.

You can get the revision number and API information with the get commands of the apictl. To get the API list, apictl get apis -e dev. You can get the revision numbers of each API with apictl get api-revisions -n StoreAPI -v 1.0.0 -r admin -e dev.

In your case, when you export the API, still the policies and resources are not reflected, this can be one of the following two things.

  1. You are exporting an outdated revision of the API. or
  2. You haven't saved the changes (Added a policy, but forgot to save)

Otherwise, resources should be listed in both api.yaml and swagger.yaml. Policies should be listed in api.yaml under each operation and the policy definition should be exported inside the Policies directory.

If it is neither, is there any error logs in the server logs? If there is, can you share them to the question?

Lakshitha
  • 1,021
  • 1
  • 6
  • 15
0

As you can see in the previouse documentation link, it exports the below artifacts into a .zip file.

<APIName>-version
├── api.yaml
├── api_meta.yaml
├── deployment_environments.yaml
├── Client-certificates
│   ├── Alias1.crt
│   ├── Alias2.crt
│   └── client_certificates.yaml
├── Definitions
│    |── swagger.yaml
|    |── schema.graphql
|    └── graphql-complexity.yaml
├── Docs
│   ├── Doc1
│   │   ├── document-file.pdf
│   │   └── document.yaml
│   ├── Doc2
│   │   ├── Doc2
│   │   └── document.yaml
│   ├── Doc3
│   │   ├── Doc3
│   │   └── document.yaml
│   └── Doc4
│       └── document.yaml
├── Endpoint-certificates
│   ├── Alias3.crt
│   ├── Alias4.crt
│   └── endpoint_certificates.yaml
├── Image
|    └── <imageName>.extension
├── WSDL   
|    └── <APIName>-<version>.wsdl  
└── Policies
    ├── <custom-policy-1-name>_<custom-policy-1-version>.j2
    ├── <custom-policy-1-name>_<custom-policy-1-version>.yaml
    ├── <custom-policy-2-name>_<custom-policy-2-version>.j2
    ├── <custom-policy-2-name>_<custom-policy-2-version>.yaml
    ├── 
    ├── 
    ├── <custom-policy-n-name>_<custom-policy-n-version>.j2
    └── <custom-policy-n-name>_<custom-policy-n-version>.yaml

Also, you need proper permissions to run this command. A user with Internal/devops role or admin role are allowed to import/export APIs.

If you are not sure whether you have correct permissions, please follow this link - https://apim.docs.wso2.com/en/4.1.0/install-and-setup/setup/api-controller/getting-started-with-wso2-api-controller#login-to-an-environment

Joy Rathnayake
  • 485
  • 4
  • 8