OceanBase Migration Service (OMS) allows you to download the schema conversion information of tables that are converted after the schema migration is completed. This topic describes how to use the three OpenAPIs: CheckHasConvertedObjects, DownloadConvertedObjectsAsync, and GetDownloadConvertedObjectsResult, to implement this feature.
Purpose
The
CheckHasConvertedObjectsinterface checks whether objects can be downloaded for the current task.If the value of
isDownloadingin the response isfalseand the value ofhasConvertedObjectsistrue, you can download the objects.The
DownloadConvertedObjectsAsyncinterface starts a task to download information about convertible objects.The
datafield in the response contains the task ID. You can call theGetDownloadConvertedObjectsResultinterface to query the task progress.The
GetDownloadConvertedObjectsResultinterface queries the result of the task to download information about convertible objects.The request parameters are the same as the response parameters of the
DownloadConvertedObjectsAsyncinterface. When the value ofcodeindataisFINISHED, the download is completed. The download result is displayed in thecsvResultfield.
Call description
Limitations
The CheckHasConvertedObjects interface is applicable to OMS V4.3.0 and later.
Request path
POST /api/v2?Action=CheckHasConvertedObjects
Request parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | The ID of the data migration task. For example, np_4w3a****. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| success | boolean | Specifies whether the call is successful. |
| errorDetail | object | Error details. |
| code | string | The error code. |
| message | string | Description. |
| advice | string | Suggestions. |
| requestId | string | The request ID. |
| pageNumber | integer | The page number. This parameter takes effect only when you query data in pages. |
| pageSize | integer | The page size. This parameter takes effect only when you query data in pages. |
| totalCount | integer | The total number of records. This parameter takes effect only when you query data in pages. |
| cost | string | The time spent in processing the request, in seconds. |
| data | object [] | The return result. |
| ├─ isDownloading | boolean | Specifies whether the objects are being downloaded. |
| ├─ hasConvertedObjects | boolean | Specifies whether convertible objects can be downloaded. |
Examples
Request example
{
"id":"np_4w3a****"
}
Response example
{
"success": true,
"errorDetail": null,
"code": null,
"message": null,
"advice": null,
"requestId": "94665a90-8****",
"pageNumber": null,
"pageSize": null,
"totalCount": null,
"cost": null,
"data": {
"isDownloading": false,
"hasConvertedObjects": false
}
}
Tab DownloadConvertedObjectsAsync
Call description
Limitations
The DownloadConvertedObjectsAsync API applies to OMS V4.3.0 and later versions.
Request path
POST /api/v2?Action=DownloadConvertedObjectsAsync
Request parameters
| Parameter | Type | Description |
|---|---|---|
| projectId | string | The ID of the data migration task. |
| onlyConverted | boolean | Specifies whether to download only conversion information. Valid values: true and false.
|
Response parameters
| Parameter | Type | Description |
|---|---|---|
| success | boolean | Specifies whether the call is successful. |
| errorDetail | object | Error details. |
| code | string | The error code. |
| message | string | The description. |
| advice | string | The suggestion. |
| requestId | string | The request ID. |
| pageNumber | integer | The page number. This parameter takes effect only when you query data in pages. |
| pageSize | integer | The page size. This parameter takes effect only when you query data in pages. |
| totalCount | integer | The total number of records. This parameter takes effect only when you query data in pages. |
| cost | string | The time spent in processing the request, in seconds. |
| data | string | The task ID of the conversion object information download task. |
Examples
Request example
{
"projectId":"np_4w3a****",
"onlyConverted": true
}
Response example
{
"success": true,
"errorDetail": null,
"code": null,
"message": null,
"advice": null,
"requestId": "94665a90-8****",
"pageNumber": null,
"pageSize": null,
"totalCount": null,
"cost": null,
"data": "t_6m****"
}
Tab GetDownloadConvertedObjectsResult
Call description
Limitations
The GetDownloadConvertedObjectsResult API applies to OMS V4.3.0 and later versions.
Request path
POST /api/v2?Action=GetDownloadConvertedObjectsResult
Request parameters
| Parameter | Type | Description |
|---|---|---|
| id | string | The ID of the download task of the convertible object information. The value of this parameter is returned by the DownloadConvertedObjectsAsync interface. Example: t_6mx****. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| success | boolean | Specifies whether the call is successful. |
| errorDetail | object | Error details. |
| code | string | Error code. |
| message | string | Description. |
| advice | string | Suggestions. |
| requestId | string | Request ID. |
| pageNumber | integer | The page number. This parameter is effective only when you perform a paged query. |
| pageSize | integer | The page size. This parameter is effective only when you perform a paged query. |
| totalCount | integer | The total number of records. This parameter is effective only when you perform a paged query. |
| cost | string | The time spent in processing the request, in seconds. |
| data | object [] | The return result. |
| ├─ csvResult | string | The result of the download task of the convertible object information. |
| ├─ message | string | The description of the download task of the convertible object information. |
| ├─ code | string | The status of the download task of the convertible object information. Valid values: PENDING, RUNNING, FINISHED, and FAILED.
|
Examples
Request example
{
"id":"t_6mx****"
}
Response example
{
"success": true,
"errorDetail": null,
"code": null,
"message": null,
"advice": null,
"requestId": "94665a90-8****",
"pageNumber": null,
"pageSize": null,
"totalCount": null,
"cost": null,
"data": {
"csvResult": "Table Name,Conversion Information\r\nTEST_OMSP0331.EMPLOYEES,\"[WARN] [DISCARD] CONSTRAINT \"\"FK_EMP_DEPT\"\" FOREIGN KEY (\"\"DEPT_ID\"\") REFERENCES \"\"DEPARTMENTS\"\" (\"\"DEPT_ID\"\") -> [NULL]\n\"",
"message": null,
"code": "FINISHED"
}
}