Your app server can call this API to synchronize custom user attributes to the Analytics Kit for analysis and audience management.
If your app server calculates some user attributes instead of obtaining them from the app, and if you want to apply these user attributes to the analysis reports provided by the Analytics Kit (for example, use the user attribute as a filtering condition for viewing reports), you can call this API to synchronize the user attributes from the app server to the Analytics Kit.
In each request, UserDataSet can carry information about a maximum of 100 users.
You can report custom user attributes through the mobile SDK or synchronize the attributes from the app server. A maximum of 25 custom user attributes are supported in total. When attributes are synchronized from the app server, the number of attributes that have been reported through the mobile SDK must be considered. The total number of attributes must not exceed the upper limit.
If an attribute is both reported through the mobile SDK and synchronized from the app server, the attribute from the app server is used.
Ensure that user personal data is not treated as custom user attributes for synchronization.
The number of requests per second does not exceed 100.
| Protocol | HTTPS POST |
|---|---|
| Direction | HUAWEI Analytics Kit server -> Developer callback API server |
| URL | POST https://<URI>/analytics/datacollection/import/user |
| Data Format | Request: Content-Type: application/json Response: Content-Type: application/json |
| Parameter | Mandatory/Optional | Type | Description |
|---|---|---|---|
data_type | Mandatory | Integer | Data type. 1: customized user attribute |
userdata_set | Mandatory | UserData[1...100] | List of users and attributes to be imported. |
| Parameter | Mandatory/Optional | Type | Description |
|---|---|---|---|
id | Mandatory | String | User ID, a string of up to 256 characters. |
properties | Mandatory | UserProperty[1...25] | List of user attributes. |
| Parameter | Mandatory/Optional | Type | Description |
|---|---|---|---|
id | Mandatory | String | User attribute ID, a string of up to 256 characters. The value can consist of digits, letters, and underscores (_) but cannot start with a digit. [example] favorite_sport |
value | Mandatory | String | User attribute ID, a string of up to 256 characters. [example] football |
Note:
In each request, UserDataSet can carry information about a maximum of 100 users.
You can report custom user attributes through the mobile SDK or synchronize the attributes from the app server. A maximum of 25 custom user attributes are supported in total. When attributes are synchronized from the app server, the number of attributes that have been reported through the mobile SDK must be considered. The total number of attributes must not exceed the upper limit.
If an attribute is both reported through the mobile SDK and synchronized from the app server, the attribute from the app server is used.
Ensure that user personal data is not treated as custom user attributes for synchronization.
The number of requests per second does not exceed 100.
| Parameter | Type | Description |
|---|---|---|
result_code | String | Response code. For details, please refer to Result Codes. |
result_msg | String | Response description. |
- 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 | Response Code | Description | Suggestion |
|---|---|---|---|---|
200 | 0 | Success | Request succeeded. | - |
400 | 10020 | invalidParameter. Parameter : %1, Reason: %2 | Invalid parameter. %1 indicates the parameter name, and %2 indicates the exception cause. | Check and correct the parameter value. |
- POST /analytics/datacollection/import/user HTTP/1.1
- Content-Type: application/json; charset=UTF-8
- Content-Length: xxxx
- Accept: application/json
- Authorization: Bearer 78C2395236BBF4262CAE4F1172E327C2929AD63EAA0395961A49DEBC3B6F8339
- x-product-id: sample-productid
- x-app-id: sample-appid
- {
- "data_type": 1,
- "userdata_set": [
- {
- "id": "123",
- "properties": [
- {
- "id": "favorite_sport",
- "value": "football"
- },
- {
- "id": "vip_users",
- "value": "true"
- }
- ]
- },
- {
- "id": "456",
- "properties": [
- {
- "id": "favorite_sport",
- "value": "basketball"
- },
- {
- "id": "vip_users",
- "value": "false"
- }
- ]
- }
- ]
- }