Any user with admin privileges can migrate the APIs from a local WSO2 API Manager (WSO2 APIM) environment to WSO2 API Cloud without having to recreate the APIs.
Let's get started!
Go to http://wso2.com/products/api-manager/ and download WSO2 API Manager 2.1.0 by clicking the DOWNLOAD button in the upper right-hand corner.
Tip: 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 API Manager, 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 API Manager by executing one of the following commands:
- On Windows:
On Linux/Solaris/Mac OS:
- On Windows:
- Sign in to the API Publisher in your local environment using the URL http://localhost:9763/publisher and credentials admin/admin.
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
Tip: You cannot import a tier to an environment if it is not supported there, although it is supported in the source environment.
For example, the Unlimited tier is supported in WSO2 API Manager, but not in WSO2 API Cloud. Therefore, you cannot import it to the Cloud.
You have now set up an instance of API Manager in your local environment and created an API in it. Let's export the API to a ZIP file.
- Install cURL in your local machine.
Using the command line (if you use a Mac/Linux) or an online Base64 encoder such as https://www.base64encode.org/, create a Base64-encoded string of the credentials of the API Manager, separated by a colon as <username>:<password>. In this example, it is admin:admin.
If you use Mac/Linux, use the following command.
echo -n <username>:<password> | base64
ex. echo -n admin:admin | base64
Tip: 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 export your API as a ZIP file.
You have exported an API to a ZIP file. Let's import that to your tenant in WSO2 API Cloud.
Log in to WSO2 Cloud by going to http://cloud.wso2.com, clicking the Sign In link and then selecting WSO2 API Cloud.
You need to construct and then copy your username which would be <email_address>@<tenant_domain>.
Create a Base64-encoded string of your API Cloud's credentials, separated by a colon as <username>:<password>.
Execute the following command to import the API to the API Cloud:
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 API Cloud.
Sign in to WSO2 API Cloud and note that the API that you imported now appears in the API Publisher.
Note that the API in the Cloud is in the CREATED state although it was in the PUBLISHED state in your local API Manager instance. This is done to enable you to modify the API before publishing it.
In this tutorial, you created an API in an API Manager and exported that to WSO2 API Cloud without having to recreate the API from scratch.