目录

Receiving the Execution Status of a Data Export Task

Overview

You need to implement this API to receive the execution status of a data export task. After a data export task is complete, this API can be used to return the data export result and download path.

Scenario

After the app server calls the API for creating a data export task, the Analytics Kit server will asynchronously export the data. When the data export is complete, the Analytics Kit server needs to send a notification carrying the task execution status and the data download path to your app server. Therefore, your app server needs to provide an API to receive the notification so that the data can be downloaded in time.

Restrictions

API Prototype

Protocol

HTTPS POST

Direction

Analytics Kit server -> your callback API server

URL

URL you have configured in AppGallery Connect. For details, please refer to Managing APIs.

Data Format

Request: Content-Type: application/json

Response: Content-Type: application/json

Request Parameters

Request body

Parameter

Mandatory

Type

Description

request_id

Yes

String

Request ID, which is returned by the API for creating a data export task.

app_id

Yes

String

App ID registered in AppGallery Connect.

status

Yes

String

Task status.

  • EXPORTED: Exported successfully.

  • NO_DATA: No matching records.

  • EXPORT_FAILED: Export failed. You are advised to try again.

  • TOO_MANY_RECORDS: Too much data is exported at a time. You are advised to narrow down the export scope and try again.

file_path

No

String

Path for downloading the exported data file. This parameter is valid only when the task status is EXPORTED.

NOTE:

If the number of data records exceeds 1 million or the data size is greater than 1 GB, multiple files are exported, and there are multiple file paths. Each file path will call this API separately.

status_time

No

DateTime

Time when the task status was last updated.

Request Example

POST /data/export/notification HTTP/1.1
User -Agent: Jakarta Commons - HttpClient / 3.1
Host: 10.137.165.233:8566
Content-Type: application/json; charset=UTF-8
Content-Length: xxxx
Accept: application/json
 
{
    "request_id": "sample-req-id", 
    "app_id": "sample-appid", 
    "status": "EXPORTED", 
    "file_path": "https://sample.com/sample_path1"
}

Response Parameters

Assume that the status code is 200.

Response header

Parameter

Mandatory

Type

Description

Content-Type

Yes

application/json

Response data format.

Response body

Parameter

Mandatory

Type

Description

result_code

Yes

String

Result code returned by the app server.

result_msg

Yes

String

Result description returned by the app server.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Connection:  Close
Content-Length: xxxx                       
 
 
{
  "result_code":"0",
  "result_msg":"success",
}