Updated on 2025-08-28 GMT+08:00

Exporting Data

Function

This API is used to export specific data of a table. The internal data of the objects created in the platform can be exported. This API exports the data of these objects based on the preset period, frequency, and filter criteria. Based on the preset execution time, the system generates a scheduled task to export data once or periodically. After the data is exported, you can call the file download API to download the file or view the task execution status based on the obtained scheduled task ID.

URI

POST Huawei Cloud Astro Zero domain name/u-route/baas/bulk/v1.0/export/data?flag=template&file_type=csv

Table 1 URI parameters

Parameter

Mandatory

Type

Description

file_type

Yes

String

Explanation

Format of the export file.

Constraints

None

Value

  • csv: The data is exported to a .csv file.
  • txt: The data is exported to a .txt file.

Default value

None

Request Parameters

Table 2 Request parameters

Parameter

Mandatory

Type

Description

cond

No

cond object

Explanation

Filter criterion for export, which is a structure containing two fields: conditions and conjunction.

Constraints

None

encodeType

Yes

String

Explanation

Encoding format of the exported file.

Constraints

None

Value

The value can be UTF-8 or GBK.

  • utf-8: UTF-8 encoding
  • gbk: GBK encoding

Default value

None

firstScheduleDate

No

String

Explanation

Time when the file is exported for the first time, in the format of yyyy-MM-dd HH:mm:ss.

Constraints

  • This parameter is mandatory when scheduleMode is set to 2.
  • If scheduleMode is set to 1, this parameter is mutually exclusive with isImmediate.

Value

None

Default value

None

objects

No

Array of Strings

Explanation

Objects to be exported. The value is a string array. Each string in the array is an object name. Data of multiple objects can be exported at the same time. You can also use the templateName parameter to specify a template for exporting data.

Constraints

None

scheduleMode

Yes

Number

Explanation

Execution times of the export task.

Constraints

None

Value

  • 1: Data is exported only once.
  • 2: Data is exported for multiple times at the specified frequency.

Default value

None

scheduleInterval

No

Number

Explanation

Interval for executing an export task.

Constraints

This parameter is mandatory when scheduleMode is set to 2.

Value

None

Default value

None

intervalUnit

No

Number

Explanation

Interval unit for executing an export task.

Constraints

This parameter is mandatory when scheduleMode is set to 2.

Value

  • Hour
  • Day
  • Month

Default value

None

isImmediate

No

Boolean

Explanation

Whether to export data immediately.

Constraints

This parameter is optional if scheduleMode is set to 1. This parameter and firstScheduleDate are mutually exclusive when scheduleMode is set to 1.

Value

None

Default value

None

templateName

No

String

Explanation

Name of the template used for data export. You can also use the objects parameter to specify the objects to be exported.

Constraints

None

Value

None

Default value

None

Table 3 cond parameters

Parameter

Type

Description

conditions

Array of condition objects

Explanation

Condition array. Each item in the array is used as a condition.

Constraints

None

conjunction

String

Explanation

Combination mode of conditions in a condition array.

Constraints

None

Value

  • AND
  • OR

Default value

None

Table 4 conditions parameters

Parameter

Mandatory

Description

field

Yes

Explanation

Filtering condition field.

Constraints

None

Value

  • createDate: creation time.
  • createBy: creator ID.
  • lastModifiedDate: last modification time.
  • lastModifiedBy: ID of the last modifier.

Default value

None

operator

Yes

Explanation

Filtering operator.

Constraints

Only the filtering fields of the time type support all operations and the filtering fields of other types support only eq and ne.

Value

  • gt: greater than
  • ge: greater than or equal to
  • eq: equal to
  • ne: not equal to
  • lt: less than
  • le: less than or equal to
  • timeFunc: time function

Default value

None

value

Yes

Explanation

Value to be compared.

Constraints

None

Value

When operator is set to timeFunc, the following functions are supported:

  • today
  • yesterday
  • last week
  • last month
  • last year
  • this week
  • this month
  • this year

If the value to be compared is of the time type, the time character string must be in the yyyy-MM-dd HH:mm:ss format.

Default value

None

Response Parameters

Table 5 Response parameters

Parameter

Type

Description

resCode

String

Explanation

Return code.

Value

If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

resMsg

String

Explanation

Message returned.

Value

If the request is successful, "Success" is returned. In other cases, an error message is returned.

result

String

Explanation

ID of the record that is successfully created.

Value

None

Example Request

  • Example 1
    To create a data export task for which scheduleMode is 1, firstScheduleDate is 2020-05-31 00:00:00, encodeType is utf-8, templateName is myTemplate, send the following request:
    POST https://Huawei Cloud Astro Zero domain name/u-route/baas/bulk/v1.0/export/data?flag=template&file_type=csv
    {
        "scheduleMode": 1,
        "firstScheduleDate": "2020-05-31 00:00:00",
        "encodeType": "utf-8",
        "templateName": "myTemplate"
    }
  • Example 2
    To create a data export task for which scheduleMode is 2, firstScheduleDate is 2020-06-01 00:00:00, scheduleInterval is 1, intervalUnit is Month, encodeType is GBK, objects is Flow and Page, field is createdBy, operator is eq, and value is 1234567890xyz, send the following request:
    POST https://Huawei Cloud Astro Zero domain name/u-route/baas/bulk/v1.0/export/data?flag=template&file_type=txt
    {
        "scheduleMode": 2,
        "firstScheduleDate": "2020-06-01 00:00:00",
        "scheduleInterval": 1,
        "intervalUnit": "Month",
        "templateName": "template01",
        "encodeType": "gbk",
        "objects": [
            "Flow",
            "Page"
        ],
        "cond": {
            "conjunction": "AND",
            "conditions": [
                {
                    "field": "createdBy",
                    "operator": "eq",
                    "value": "1234567890xyz"
                }
            ]
        }
    }

Example Response

  • Example 1
    {
        "resCode": "0",
        "resMsg": "Success",
        "result": "abcdefghijklmnopqrst"
    }
  • Example 2
    {
        "resCode": "0",
        "resMsg": "Success",
        "result": "1234567890abcdefg"
    }

Status Code

See Status Codes.

Error Code

See Error Codes.