# databaseMigrateImport

Call this API at the server side. For more information, see Server API.

Imports files to database.

# Request Address

POST https://api.weixin.qq.com/tcb/databasemigrateimport?access_token=ACCESS_TOKEN

# Request Parameters

Attribute Type Default Required Description
access_token string Yes Credentials to call API
env string Yes Cloud environment ID
collection_name string Yes Name of collection to import files
file_path string Yes Path to import files. Files to be imported should be uploaded to the storage in the same environment. Upload files by using the Developer Tools or the Upload File API of HTTP API.
file_type number Yes Import file type. For file format, see File Format in Database Import Guidelines.
stop_on_error bool Yes Indicates whether to stop importing when an error occurs
conflict_mode number Yes Conflict processing mode

Valid values of file_type

Value Description Minimum Version
1 JSON
2 CSV

Valid values of conflict_mode

Value Description Minimum Version
1 INSERT
2 UPSERT

# Return Value

# Object

JSON data package that is returned

Attribute Type Description
errcode number Error code
errmsg string Error message
job_id number Import task ID. Use the databaseMigrateQueryInfo API to query the import process and result.

Valid values of errcode

Value Description Minimum Version
0 Request successful
-1 System Error
-1000 System Error
40014 Invalid AccessToken
40097 Invalid request parameter
40101 Required parameter missing
41001 AccessToken missing
42001 AccessToken expired
43002 HTTP METHOD error
44002 Empty POST BODY
47001 Incorrect format of POST BODY
85088 Cloud Base is not enabled on this App
Other error codes Cloud Base error codes

# Request Data Example

{
	"env": "qbasetest-a5c40e",
	"collection_name": "test1",
	"file_path":"test_import",
	"file_type":1,
	"stop_on_error": false,
	"conflict_mode": 2
}

# Return Data Example

{
    "errcode": 0,
    "errmsg": "ok",
    "job_id": 100074947
}

点击咨询小助手