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
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
file_type |
Yes |
String |
Explanation Format of the export file. Constraints None Value
Default value None |
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.
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
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
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
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 |
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
Default value None |
Parameter |
Mandatory |
Description |
---|---|---|
field |
Yes |
Explanation Filtering condition field. Constraints None Value
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
Default value None |
value |
Yes |
Explanation Value to be compared. Constraints None Value When operator is set to timeFunc, the following functions are supported:
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
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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot