目录

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 interface that creates a data export task, the Analytics Kit server will asynchronously export the data. When the data export is completed, the Analytics Kit server needs to send a notification carrying the task execution task and the data download path to your app server. Therefore, your app server needs to provide an interface to receive the notification so that the user can download the data in time.

Restrictions

Interface Prototype

Protocol

HTTPS POST

Direction

HUAWEI Analytics Kit server -> Developer callback API server

URL

{rootUrl}/sub/applications/{apiVersion}/purchases/get

Data Format

Request: Content-Type: application/json

Response: Content-Type: application/json

Request

Table1 Request body
ParameterMandatory/OptionalTypeDescription

request_id

Mandatory

string

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

app_id

Mandatory

string

App ID registered in AppGallery Connect.

status

Mandatory

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

Optional

string

Path for downloading the exported file. This field has a value only when status is EXPORTED.

status_time

Optional

DateTime

Last status update time.

Response

Table2 Response body
ParameterTypeDescription

result_code

String

Result code returned by the app server.

result_msg

String

Result description returned by the app server.

Response Example

  1. HTTP/1.1 200 OK
  2. Content-Type: application/json; charset=UTF-8
  3. Connection:  Close
  4. Content-Length: xxxx                      
  5. {
  6.  "result_code":"0",
  7.  "result_msg":"success",
  8. }

Call Example

  1. POST /data/export/notifcation HTTP/1.1
  2. User -Agent: Jakarta Commons - HttpClient / 3.1
  3. Host: 10.137.165.233:8566
  4. Content-Type: application/json; charset=UTF-8
  5. Content-Length: xxxx
  6. Accept: application/json
  7. {
  8.    "request_id": "sample-req-id",
  9.    "app_id": "sample-appid",
  10.    "status": "EXPORTED",
  11.    "file_path": "https://sample.com/sample_path/"
  12. }