API Gateway 10.11 | Upgrading and Migrating to API Gateway | Upgrading API Gateway in Zero Downtime | Introduction | Migration REST API
 
Migration REST API
You must perform the migration in the new API Gateway instance using the migration REST API.
The migration REST API triggers the migration action and returns a 202 status code, indicating that the migration request is accepted. When the action is completed, a webhook event with the migration status is sent to the registered webhook clients.
1. Clean the Elasticsearch or API Data Store.
This action deletes the data from the Elasticsearch or API Data Store. You must run this request before invoking the re-index request for core indices.
POST /rest/apigateway/migration

{
"action": "clean"
}
Note:
As a safety measure, by default this action takes a backup, before deleting the data. As a prerequisite to backup data, you must configure the path.repo property in the elasticsearch.yml file for the Elasticsearch or API Data Store, to take a snapshot in the location specified in the path.repo property. If the administrator deliberately wants to exclude the backup of the data, then add "backup": false in the payload.
2. Re-index the Elasticsearch or API Data Store.
The re-index action re-indexes the data from the old Elasticsearch or API Data Store to new Elasticsearch or API Data Store.
Note:
The remote data store host must be explicitly allowed in elasticsearch.yml file using the reindex.remote.whitelist property. Configure the reindex.remote.whitelist in the elasticsearch.yml file located at SAGInstallDIr/InternalDataStore/config/.
An example to set the value of old Elasticsearch or API Data Store host and port is as follows:
reindex.remote.whitelist: localhost:9200
The request to re-index the Elasticsearch or API Data Store is as follows:
POST /rest/apigateway/migration

{
"action": "reindex",
"indicesType": "core/analyticsandlogs",
"sourceElasticsearch": {
"url": "http://remotehost:9240",
"username": "username",
"password": "password"
},
"properties": {
"apigateway.migration.srcTenantName": "default",
"apigateway.migration.batchSize": 100,
"apigateway.migration.logLevel": "info",
"apigateway.migration.reindex.status.check.sleep.interval": 5000,
"apigateway.migration.batchSize.gateway_{0}_apis": 50,
"apigateway.migration.batchSize.gateway_{0}_log": 100,
"apigateway.migration.batchSize.gateway_{0}_audit_auditlogs": 50,
"apigateway.migration.batchSize.gateway_{0}_analytics_transactionalevents": 50
}
}
The parameters used in the above request are described in the following table:
Parameter
Description
indicesType
Specifies the type of indices to be re-indexed from the old Elasticsearch or API Data Store to new Elasticsearch or API Data Store. The possible values are core and analyticsandlogs. Core indices are used to store the design time assets like APIs, alias, configurations, and so on. Analyticsandlogs indices are used to store the logs and events like performance metrics, license metrics, and logs.
sourceElasticsearch
The old Elasticsearch or API Data Store details.
properties
These migration properties can be used to specify the old API Gateway instance's tenant name and optimize the performance of the re-index action. If not specified, the values from migration.properties file located at SAG\IntegrationAPI Gateway server\instances\default\packages\WmAPIGateway\bin\migrate are taken.
3. Transform the Elasticsearch or API Data Store data.
The transform action transforms the re-indexed assets in the new Elasticsearch or API Data Store to be compatible with the new API Gateway version. The request to perform the transformation is as follows:
POST /rest/apigateway/migration

{
"action": "transform"
}
4. Optional. Use the following request to check the migration action status.
GET /rest/apigateway/migration/status?action=[reindex | transform | clean]
Response

{
"status": "success",
"failureReason": null
}