Any user with admin privileges can migrate the APIs from WSO2 API Cloud to another environment without having to recreate the APIs.
Let's get started!
- Log in to WSO2 Cloud by going to https://cloud.wso2.com, clicking the Sign In link, selecting WSO2 API Cloud, and entering your credentials.
Create and publish an API with the following details. If you do not know how to create and publish an API, see Create and Publish an API.
Tab Name Parameters Values Design Tab Name PhoneTest Context
Version 1.0.0 Visibility Public API Definition
Click Next without entering anything and the system will prompt you to add a wildcard resource (/*). Click Yes.
Implement Tab -> Managed API Production Endpoint http://ws.cdyne.com/phoneverify/phoneverify.asmx Manage Tab Tier Availability
You cannot import a tier to an environment if it is not supported there, although it is supported in the source environment.
For example, if you may have a tier (e.g., Gold-Updated tier) that is supported in WSO2 API Cloud, but not in your local WSO2 API Manager setup. Therefore, in the latter mentioned scenario you cannot import the tier from WSO2 API Cloud to your local machine.
- You need to construct and then copy your username which would be <email_address>@<tenant_domain>.
- Use command line (if you are on mac/linux environment) or an online Base64 encoder such as https://www.base64encode.org/, to create a Base64-encoded string of your WSO2 API Cloud's credentials, using the following format.
If you are on mac/linux environment you can use following command.
echo -n <username>:<password> | base64
Install cURL in your local machine if it is not already installed.
Execute the following command to export your API from your tenant account in the WSO2 API Cloud as a ZIP file.
You have exported an API to a ZIP file. Let's import that to your local WSO2 API Manager environment.
Setup an instance of WSO2 API Manager in your local environment.
Go to http://wso2.com/products/api-manager/ and download WSO2 API Manager 2.0.0 by clicking the DOWNLOAD button in the upper right-hand corner.
To migrate APIs, your local environment must have the same API Manager version that the API Cloud runs on.
- Extract the ZIP file to a suitable location in your machine. Let's call this location
- To export the API that you will later create in the WSO2 API Cloud, you need the API Import/Export tool provided by WSO2. Download this WAR file and copy it to the
<APIM_HOME>/repository/deployment/server/webappsfolder. It deploys the API Import/Export tool in your API Manager server.
- Start the WSO2 API Manager by executing one of the following commands:
- On Windows:
On Linux/Solaris/Mac OS:
- On Windows:
Using an online Base64 encoder such as https://www.base64encode.org/, create a Base64-encoded string of your credentials of the WSO2 API Manager in the following format.
<username>:<password>In this example, it is
Only users with admin privileges can migrate APIs between environments using the API Import/Export tool.
Navigate to a suitable location using the command-line or terminal and execute the following cURL command to import your API to your WSO2 API Manager local environment.
Tip: Make sure the name and context of the API that you are importing (e.g., PhoneTest and
/phonetest) do not duplicate that of an existing API in the local WSO2 API Manager environment.
Log in to your local setup of WSO2 API manager and note that the API that you imported now appears in the API Publisher.
Note that the API in the local API Manager instance is in the CREATED state although it was in the PUBLISHED state in the WSO2 API Cloud. This is done to enable you to modify the API before publishing it.
In this tutorial, you created an API via WSO2 API Cloud and exported that to your WSO2 API Manager environment without having to recreate the API from scratch.