# databaseMigrateExport

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

Exports files from database.

# Request Address

POST https://api.weixin.qq.com/tcb/databasemigrateexport?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
file_path string Yes Path to export files. Files are exported to cloud storage in the same environment. You can get the download URL by using the batchDownloadFile API.
file_type number Yes Export file type. For file format, see File Format in Database Import Guidelines.
query string Yes Export conditions

Valid values of file_type

Value Description Minimum Version
1 JSON
2 CSV

# Return Value

# Object

JSON data package that is returned

Attribute Type Description
errcode number Error code
errmsg string Error message
job_id number Export task ID. Use the databaseMigrateQueryInfo API to query the export result and get file download URL.

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":"test2-4a89da",
    "file_path":"test_export",
    "file_type":1,
    "query":"const Point = db.Geo.Point;db.collection(\'geo\').where({name: \'x\',age: _.gt(10).and(_.lt(20)),loc: new Point(113,23),array: [1,2]}).limit(10).skip(1).orderBy(\'age\',\'asc\').orderBy(\'name\', \'desc\').field({ name: true }).get()"
}

# Return Data Example

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

# Descriptions of Export Conditions

Query statements use the same syntax with Database APIs