When a user initiates a personal data export request on the app, the app server calls this API to export an electronic copy of data from Analytics Kit.
As required by the GDPR, you may need to allow end users to obtain an electronic copy of their personal data by providing a button in your app. When a user taps this button, your app server calls this API to export the electronic copy of personal data that has been collected and reported to the Analytics Kit server.
After the app server calls this API, the Analytics Kit server will asynchronously export the data. The app server needs to periodically query the export task status and download the exported data for end users in a timely manner.
Protocol | HTTP POST |
|---|---|
Direction | Your callback API server -> Analytics Kit server |
URL | {rootUrl}/analytics/gdpr/user_data_export_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 | Authentication information. 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
POST /analytics/gdpr/user_data_export_requests/v2 HTTP/1.1
Content-Type: application/json; charset=UTF-8
Content-Length: xxxx
Accept: application/json
Authorization: Bearer ***
x-product-id: sample-productid
x-app-id: sample-appid
{
"aaid":"sample-aaid"
} 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. |
Assume that the status code is 200.
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Connection: Close
Content-Length: xxxx
{
"result_code":"0",
"result_msg":"success"
} Status Code | Result Code | Description | Solution |
|---|---|---|---|
200 | 0 | The request is received successfully. | - |
400 | 10020 | Invalid parameter. | Check and correct the parameter value. |
400 | 10021 | The client ID is inconsistent with the app ID. | Use the client ID and client secret of the app to obtain the authentication information. |
400 | 10030 | The data cannot be exported because it has been deleted at the request of the user. | Display a message indicating that the data has been deleted. |
400 | 10031 | The data cannot be exported because the interval between this data export request and the previous one is less than two months. | Display a message notifying the user that the interval between two consecutive data export requests must be two months at least. |
400 | 10008 | Requests are too frequent. | Display a message prompting the user to reduce the frequency of requesting data export and asking the user to try again later. |
400 | 19910 |
| Try again later. |