Object Migration
Object Migration is the process of migrating or moving objects between environments.
You may want to migrate objects for several reasons such as managing global deployments on multiple environments or creating multiple environments so that you can separate the development, testing, and production processes.
Object Migration Rest Endpoints to support Migration of Object available in MMG
Table 2-1 Object Migration Rest Endpoints to support Migration of Object available in MMG
| Sr No | Object Migration API | Technical Standards to Follow | Method | Endpoint | Sample Request | Sample Response |
|---|---|---|---|---|---|---|
| 1 | Save Export Definition | Headers: ofs_workspace_id ofs_remote_user locale (default set as en-US) | POST | /v1/public/migrate/export/outline | { "migrationCode":"testexp42", "exportObjects":[ {"objectCode":"TEST_population", "objectType":"BATCH" } ]} |
output success-> { "response": { "message": "Migration outline definition saved successfully." } } output failed -> { "migrationCode": "testexp42", "errorMessage": "objectCode/Type missing", "statusCode": "INVALID_INPUT", "status": "FAILED" } |
| 2 | Invoke Export | Headers: ofs_workspace_id ofs_remote_user locale (default set as en-US) | POST | /v1/public/migrate/export/{code} | { "response": { "message": "Object Migration Triggered Successfully" } } |
|
| 3 | Save Import Definition | Headers: ofs_workspace_id ofs_remote_user locale (default set as en-US) | POST | /v1/public/migrate/import/outline | { "migrationCode":"imp1_exp41", "fileName":"TEST_TESTEXP41_06082024_680336", "code":"imp1_exp41" } |
{ "response": { "message": "Migration outline definition saved successfully." } } |
| 4 | Invoke Import | Headers: ofs_workspace_id ofs_remote_user locale (default set as en-US) | POST | /v1/public/migrate/import/{code} | { "response": { "message": "Object Migration Triggered Successfully" } } |
All APIs should be invoked through Gateway port, if enabled, and UI port, if not enabled. Auth should be the bearer token, which is same as OFS_AAI.
Use Bearer Token Authentication
We can execute these APIs: https://[<mmg_ui_gateway_url/ui_url>/<contextname>/rest-api/v1/token|https://ofss-mum-1035.snbomprshared1.gbucdsint02bom.oraclevcn.com:6773/mmg8127/rest-api/v1/token]
Basic Auth: ofsauser/secret (configured as properties in the app.property file)
Response: {"token_type":"Bearer","expires_in":3600,"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJhZTZkNTUyMC0zYTQwLTRhMjctYTg1OC0yNzFmY2FjN2YzMWQiLCJpc3MiOiJPRlNBQSIsInN1YiI6Im9mc2F1c2VyIiwic3ViamVjdFR5cGUiOiJjbGllbnRJRCIsImlhdCI6MTc0MTA4MjQ4MCwiZXhwIjoxNzQxMDg2MDgwfQ.XqbtbZYqKnY1RQv4EW371iZHxrpNWBuNMX8ef161AhwKozc3qfYgLG3fXYfwrQhT9VdSUfoGu1-stdTYWIs2O3RtWBniuYyjkR5ghXCYwVkzypxmLALx6v8H3bl1g248GrNPZHTy1tgKfhYbDM-nCl5f__ztZh8I0IApA6xImRHFisd5MRv0dVvNn3vsdJd7onLgEQWnCEBGgT6HQ2QfuAECeulv5V4gtOlcAib8BWoKJM-NCVPiov5uaDPYOklyMljdvA6z5Cmr6-gOMWIjyX16GLtBSDgBAvsEopLznwnmiQLSEPwAnp8Y3KJZwQQVlS2zY033XDv9B8eufXkeOA"}
# save export definition eg:-[https://<mmg_ui_gateway_url/ui_url>/<contextname>|https://host/]/v1/public/migrate/export/outline input json:
{ "migrationCode":"testexp42", "exportObjects":[ \{"objectCode":"TEST_population", "objectType":"BATCH" } ]} headers:- ofs_workspace_id (default set as TEST) ofs_remote_user (default set as aaaiuser) locale (default set as en-US) output success-> { "response": \{ "message": "Migration outline definition saved successfully." } } output failed -> \{ "migrationCode": "testexp42", "errorMessage": "objectCode/Type missing", "statusCode": "INVALID_INPUT", "status": "FAILED" }
Invoke Export
For example:[https://<mmg_ui_gateway_url/ui_url>/<contextname>|https://host/]/v1/public/migrate/export/\{migrationCode} output-> { "response": \{ "message": "Object Migration Triggered Successfully" } } headers:- ofs_workspace_id (default set as TEST) ofs_remote_user (default set as aaaiuser) locale (default set as en-US)
Save Import Definition
For example:[https://<mmg_ui_gateway_url/ui_url>/<contextname>|https://host/]/v1/public/migrate/import/outline input Json:- \{ "migrationCode":"imp1_exp41", "fileName":"TEST_TESTEXP41_06082024_680336", "code":"imp1_exp41" } headers:- ofs_workspace_id (default set as TEST) ofs_remote_user (default set as aaaiuser) locale (default set as en-US) output success-> { "response": \\{ "message": "Migration outline definiton saved successfully." }
}
Invoke Import
For example:[https://<mmg_ui_gateway_url/ui_url>/<contextname>|https://host/]<context>/v1/public/migrate/import/\{migrationCode} headers:- ofs_workspace_id (default set as TEST) ofs_remote_user (default set as aaaiuser) locale (default set as en-US) output success->output-> { "response": \\{ "message": "Object Migration Triggered Successfully" }
}
Object Migration REST APIs (MMG)
Object Migration enables moving MMG objects between environments (for example, DEV to UAT to PROD) to support controlled deployments and environment separation.
Base URL and Connectivity
All Object Migration APIs must be invoked by using the MMG base URL:
If the gateway is enabled, then use the gateway host and port.
If the gateway is not enabled, then use the MMG UI host and port.
Base URL format: https://<MMG_SERVICE_HOST>:<MMG_GATEWAY_OR_UI_PORT>/<WEB_CONTEXT>/
For example:https://<host>:<port>/mmg8133/
Authentication (Bearer Token same as OFS_AAI)
All migration APIs require Bearer token authentication, using the same token mechanism as OFS_AAI.
Get Bearer Token
Endpoint:POST /rest-api/v1/token
Authentication:Use the basic auth (client/user credentials configured in your deployment)
Example (curl):
curl -k -u "<CLIENT_ID>:<CLIENT_SECRET>" -X POST
"https://<MMG_SERVICE_HOST>:<MMG_GATEWAY_OR_UI_PORT>/<WEB_CONTEXT>/rest-api/v1/token"
Sample Response:
{
"token_type": "Bearer",
"expires_in": 3600,
"token": "<JWT_TOKEN_VALUE>"
}
Use the Token
For all Object Migration APIs, include:
Authorization: Bearer <JWT_TOKEN_VALUE>
Required Headers (All Object Migration APIs)
Include the following headers on every request:
ofs_workspace_id: <WORKSPACE_ID>
ofs_remote_user: <REMOTE_USER>
locale: en-US (default)
Also include standard headers as applicable:
Content-Type: application/json
Authorization: Bearer <JWT_TOKEN_VALUE>
Object Migration Endpoints
Save Export Definition
Creates an export outline definition (objects to export).
Method/Endpoint:POST /v1/public/migrate/export/outline
Request Body (example):
{
"migrationCode": "testexp42",
"exportObjects": [
{
"objectCode": "TEST_population",
"objectType": "BATCH"
}
]
}
Success Response (example):
{
"response": {
"message": "Migration outline definition saved successfully."
}
}
Failure Response (example):
{
"migrationCode": "testexp42",
"errorMessage": "objectCode/Type missing",
"statusCode": "INVALID_INPUT",
"status": "FAILED"
}
Example (curl):
curl -k -X POST
"https://<MMG_SERVICE_HOST>:
<MMG_GATEWAY_OR_UI_PORT>/<WEB_CONTEXT>/v1/public/migrate/export/outline"
-H "Authorization: Bearer <JWT_TOKEN_VALUE>"
-H "Content-Type: application/json"
-H "ofs_workspace_id: <WORKSPACE_ID>"
-H "ofs_remote_user: <REMOTE_USER>"
-H "locale: en-US"
-d '
{ "migrationCode": "testexp42", "exportObjects": [ { "objectCode": "TEST_population", "objectType": "BATCH" }
]
}'
Invoke Export
Triggers export execution for a previously saved export definition.
Method/Endpoint:
POST /v1/public/migrate/export/
Where:
= migrationCode used in Save Export Definition
Success Response (example):
{
"response": {
"message": "Object Migration Triggered Successfully"
}
}
Example (curl):
curl -k -X POST
"https://<MMG_SERVICE_HOST>:
<MMG_GATEWAY_OR_UI_PORT>/<WEB_CONTEXT>/v1/public/migrate/export/testexp42"
-H "Authorization: Bearer <JWT_TOKEN_VALUE>"
-H "ofs_workspace_id: <WORKSPACE_ID>"
-H "ofs_remote_user: <REMOTE_USER>"
-H "locale: en-US"
Save Import Definition
Creates an import outline definition (dump file to import and import code).
Method/Endpoint:POST /v1/public/migrate/import/outline
Request Body (example):
{
"migrationCode": "imp1_exp41",
"fileName": "TEST_TESTEXP41_06082024_680336",
"code": "imp1_exp41"
}
Success Response (example):
{
"response": {
"message": "Migration outline definition saved successfully."
}
}
Example (curl):
curl -k -X POST
"https://<MMG_SERVICE_HOST>:
<MMG_GATEWAY_OR_UI_PORT>/<WEB_CONTEXT>/v1/public/migrate/import/outline"
-H "Authorization: Bearer <JWT_TOKEN_VALUE>"
-H "Content-Type: application/json"
-H "ofs_workspace_id: <WORKSPACE_ID>"
-H "ofs_remote_user: <REMOTE_USER>"
-H "locale: en-US"
-d '{
"migrationCode": "imp1_exp41",
"fileName": "TEST_TESTEXP41_06082024_680336",
"code": "imp1_exp41"
}'
Invoke Import
Triggers import execution for a previously saved import definition.
Method/Endpoint:POST /v1/public/migrate/import/
Where:
= migrationCode used in Save Import Definition
Success Response (example):
{
"response": {
"message": "Object Migration Triggered Successfully"
}
}
Example (curl):
curl -k -X POST
"https://<MMG_SERVICE_HOST>:
<MMG_GATEWAY_OR_UI_PORT>/<WEB_CONTEXT>/v1/public/migrate/import/imp1_exp41"
-H "Authorization: Bearer <JWT_TOKEN_VALUE>"
-H "ofs_workspace_id: <WORKSPACE_ID>"
-H "ofs_remote_user: <REMOTE_USER>"
-H "locale: en-US"
Note:
Use the gateway port when the gateway is enabled; else use the UI port. Authorization must be the Bearer token (OFS_AAI token mechanism). Ensure thatofs_workspace_id and ofs_remote_user are correctly populated per your deployment conventions.