The app server calls this API to create a data export task that exports all the data collected and reported by the app.
If you need to import the data collected by Analytics Kit to your own analytics platform or a third-party analytics platform for analysis, you can use this API to export data that has been collected by Analytics Kit.
Protocol | HTTP POST |
|---|---|
Direction | Your callback API server -> Analytics Kit server |
URL | {rootUrl}/analytics/export/raw_data_requests/v2 NOTE: For details about {rootUrl}, please refer to API Access Address. |
Data Format | Request: Content-Type: application/json Response: Content-Type: application/json |
Request header
Parameter | Mandatory | Type | Description |
|---|---|---|---|
x-product-id | Yes | String | Product ID registered in AppGallery Connect. |
x-app-id | Yes | String | App ID registered in AppGallery Connect. |
Authorization | Yes | String | For details, please refer to OAuth 2.0-based Authentication. NOTE: A space character must be added between Bearer and the value of access_token. |
Request body
Parameter | Mandatory | Type | Description |
|---|---|---|---|
date_range | Yes | DateRange | Time range for query. |
file_format | Yes | String | File format. Only the .csv format is supported. |
filters | No | List<Filter> | Attribute filter conditions. |
DateRange parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
start_date | Yes | String | Start date, in the format of yyyy-MM-dd. |
end_date | Yes | String | End date, in the format of yyyy-MM-dd. |
Filter parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
name | Yes | String | User attribute name. |
values | Yes | String | User attribute values. |
POST /analytics/export/raw_data_requests/v2 HTTP/1.1
Content-Type: application/json; charset=UTF-8
Accept: application/json
Authorization: Bearer ***
x-product-id: sample-productid
x-app-id: sample-appid
{
"date_range": {
"start_date": "2020-03-10",
"end_date": "2020-03-17"
},
"file_format": "csv",
"filters": [
{
"name": "model",
"values": [
"TL-00",
"MTA-00"
]
}
]
} 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. For details, please refer to Result Codes. |
result_msg | Yes | String | Response description. |
request_id | Yes | String | Request ID, which is returned by the API for creating a data export task. |
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Connection: Close
Content-Length: xxxx
{
"result_code":"0",
"result_msg":"success",
"request_id": "c0b41debe8064c54ab200d30907f40c5"
} Status Code | Result Code | Description | Solution |
|---|---|---|---|
200 | 0 | Request successful. | - |
400 | 10020 | Invalid parameter. | Check and correct the parameter value. |
400 | 10008 | Requests are too frequent. | Reduce the frequency of creating data export tasks. |
400 | 10009 | The number of ongoing export tasks of an app exceeds 3, which is the upper limit. | Wait until some or all of the ongoing tasks are complete and try again later. |
400 | 19910 |
| Try again later. |