Initiate File Import Task

Last updated: 2017-12-14 11:49:55

1. API Description

This API (StartCdbImportJob) is used to initiate a file import task.
Domain for API request: cdb.api.qcloud.com

2. Input Parameters

The following request parameter list only provides API request parameters. Common request parameters need to be added when the API is called. For more information, refer to Common Request Parameters. The Action field for this API is StartCdbImportJob.

Parameter Name Required Type Description
uInstanceId Yes Int ID of the instance on which an import will be performed, such as: cdb-c1nl9rpv. It is identical to the instance ID displayed in the Cloud Database console page and can be obtained using API Query List of Instances. Its value equals to the uInstanceId field value in the output parameter.
dbName No Int Name of the destination database to which the files are imported. If the parameter is not passed, it means not specifying a database
rootPassword Yes Int root password of the instance
fileName Yes Int Names of files to be imported, which can be obtained via the API for querying the list of files to be imported

3. Output Parameters

Parameter Name Type Description
code Int Common error code; 0: Succeeded; other values: Failed. For more information, please refer to Common Error Codes on the Error Code page.
message String Module error message description depending on API.
codeDesc String Error description
data Object Import task details

Parameter data is composed as follows:

Parameter Name Type Description
jobId Int Task ID, which can be used to terminate the task

4. Error Codes

The following error codes only include the business logic error codes for this API.

Error Code Error Message Error Description
9003 InvalidParameter Incorrect parameter
9520 InternalError File import internal error
9541 Import.FileSize File content cannot be empty
9572 InstanceNotExists Instance does not exist
9576 OperationDenied Instance is not running, or is executing other operations
9587 InvalidParameter Wrong password
9590 InternalFailure File import internal error

5. Example

Input

https://cdb.api.qcloud.com/v2/index.php?Action=StartCdbImportJob
&<Common request parameters>
&uInstanceId=cdb-2d9mgksg
&rootPassword=xxxxxxxx
&fileName=test.sql

Output

{
    "code":"0",
    "message":"",
    "codeDesc":"Success",
    "data":{
        "jobId": "18302"
     }
}