承载协议 | HTTPS POST |
|---|---|
接口方向 | 开发者回调接口服务器->分析服务服务器 |
接口URL | {rootUrl}/analytics/datacollection/import/user 说明: {rootUrl}:请参见接口访问路径获取。 |
数据格式 | 请求消息:Content-Type: application/json 响应消息:Content-Type: application/json |
Request Header
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
x-product-id | 是 | String | 用户在AppGallery Connect上的Product ID。 |
x-app-id | 是 | String | 用户在AppGallery Connect上的App ID。 |
Authorization | 是 | String | 鉴权信息。请参见基于OAuth 2.0开放鉴权。 说明: Bearer后面拼接空格,再拼接获取的access_token。 |
Request Body
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
data_type | 是 | Integer | 自定义用户属性的数据类型。 固定填写为1。 |
userdata_set | 是 | UserData[1…100] | 待导入的用户及属性列表。 |
UserDataSet数据结构说明
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
id | 是 | String | 匿名化用户标识,在华为分析服务侧通过此标识关联用户数据。只有您可以使用该标识符追溯到具体用户,分析系统无法使用您设置的id追溯到具体用户。 非空,长度不超过256字符。 |
properties | 是 | UserProperty[1…25] | 用户属性列表。 |
UserProperty数据结构说明
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
id | 是 | String | 用户属性的ID,由数字、字母、下划线组合成,且不能以数字开头,1-256个字符。例如:favorite_sport。 |
value | 是 | String | 用户属性值,1-256个字符。例如:football。 |
POST /analytics/datacollection/import/user 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 { "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" } ] } ] }
状态码为200时:
Response Header
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
Content-Type | 是 | application/json | 响应消息的数据格式。 |
Response Body
参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
result_code | 是 | String | 响应码,请参见错误码。 |
result_msg | 是 | String | 响应描述。 |
HTTP/1.1 200 OK Content-Type: application/json; charset=UTF-8 Connection: Close Content-Length: xxxx { "result_code":"0", "result_msg":"success" }