This documentation is for WSO2 API Manager 2.0.0. View documentation for the latest release.

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...


Code Block
curl -H "Authorization:Basic <base64-encoded-credentials-separated-by-a-colon>" 
-X GET "https://<APIM_HOST:Port>/api-import-export-<product-version>-<tool-version>/export-api?name=<API-name>&version=<API-version>
&provider=<API-provider>" -k > <exportedApiName>.zip
Tip

To obtain <base64-encoded-credentials-separated-by-a-colon> use a base64 encoder (e.g., https://www.base64encode.org/) to encode your client ID and client secret username and password which has admin role using the following format: <clientId><username>:<clientSecret><password> Thereafter, enter the encoded value for this parameter.


Here's an example:

...

  • To export an API from a tenant, follow the steps in Export an API. Use the tenant-specific encoded credentials in the cURL command. Here's an example: 

    Code Block
    curl -H "Authorization:Basic AbCdEfG" -X GET "https://<host>:port/api-import-export-2.0.0-v0v3/export-api?name=sample&version=1.0.0&provider=user@domain.com" -k > exportedApiName.zip
  • To import the API in another tenant, follow the steps in Importing an API. Use the encoded credentials for this tenant in the cURL command. Here's an example:

    Code Block
    curl -H "Authorization:Basic AbCdEfG" -F file=@"/home/user/Desktop/exportedApiName.zip" -k -X POST "https://<host>:port/api-import-export-2.0.0-v0v3/import-api?preserveProvider=false"

    Note that the preserveProvider parameter value should be set to false.

...

The API import/export tool uses a RESTful API, protected by basic authentication. Only users with admin privileges role are allowed to access it in the initial phase. To allow access to the import/export feature only for a particular tenant, log in to WSO2 API Manager's Management Console and add the downloaded archive file as a web application to the server.

Note

To access API import/export, you need to assign the admin role to the user.

'admin' role is the default role which is specified in the Realm configuration in <APIM-HOME>/repository/conf/user-mgt.xml. It will be changed if you have changed this <AdminRole> value in below configuration.

Code Block
<Realm>
        <Configuration>
		<AddAdmin>true</AddAdmin>
            <AdminRole>admin</AdminRole>            
         .....
       </Configuration>
</Realm>


The export functionality

API export functionality retrieves the information required for the requested API from the registry and databases and generates a ZIP file, which the exporter can download. This exported ZIP file has the following structure:

...