Migrating managed Developer portal between APIM services
The developer portal supports programmatic access to content. It allows you to extract the data from or upload it to your API Management service through the content management REST API.
To simplify automation of this process, a script has been prepared for that purpose which is available here scripts.v2/migrate.js.
It exports the content of the developer portal from one API Management service and imports it into the developer portal of another API Management service - for example, exports from a test environment and imports into the production environment.
Let’s get started!
In order to initiate the migration process, you need to:
npm installin the root of the project.
Change directory (cd) into the scripts.v2 folder.
Now run the portal command below with a valid combination of arguments.
Pre — Execution
You need to provide the required parameters to run the script: source management API endpoints, destination management API endpoints, destination developer portal URL, source SAS token, destination SAS token.
Source Management API endpoint & SAS Token
Destination Management API endpoint & SAS Token
Destination Developer Portal URL
Be sure to substitute and input all the required parameters in the managed portal command on a note pad.
The command performs the following steps:
Capture the portal content from the source API Management service (excl. media).
Remove the portal content from the destination API Management service (incl. media).
Upload the portal content to the destination API Management service (excl. media).
Download the portal’s media files from the source API Management service.
Upload the portal’s media files to the destination API Management service.
(Optional) If you’re using a managed portal, you can set the script to auto-publish the destination portal to make the migrated version automatically available to the visitors.
Call to action
Clone the repository which contains the source code of the developer portal locally.
From your command prompt, now cd into the cloned folder
Run npm install
Once all the dependencies have been installed.
Then copy and run the managed portal command with a valid combination of arguments as seen below:
With that, be rest assured all contents (including media) have been migrated to the destination portal.
Post — Execution
Source Developer Portal URL
After the script is successfully executed, the destination developer portal should contain the same content as the source developer portal.
Although you’ll be able to see it as an administrator, the script doesn’t publish the portal of the target service to external visitors.
You need to publish the portal through its administrative user interface bounded in red box. You can find instructions to do so here.
Destination Developer Portal only visible as administrator
Now Click on Operations then Publish Website
Voila! The published target APIM service developer portal publicly available to external visitors.
Target APIM Service Developer Portal Publicly available to external visitors.
In conclusion, we have been able to successfully export the content of the developer portal from one API Management service and imports it into another API Management service with this guide.