If your app server collects content that is not reported by the app, and if you want to apply the content to the analysis reports provided by Analytics Kit, you can call this API on the app server to synchronize the content from the app server to Analytics Kit.
Protocol | HTTPS POST |
|---|---|
Direction | Your callback API server -> Analytics Kit server |
URL | {rootUrl}/analytics/datacollection/import/item 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
Parameter | Mandatory | Type | Description |
|---|---|---|---|
data_type | Yes | Integer | Data type, indicating whether the data is content. This parameter has a fixed value of 2. |
item_set | Yes | Item | List of content to be imported. |
item_set parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
id | Yes | String | Content ID. |
type | Yes | String | Content type.
|
status | No | int | Indicates whether the content can be recommended. The default value is 1.
|
name | No | String | Content name or title. |
category | No | String | Content category, for example, music or stress relief. |
section | No | String | Content section or channel. |
weight | No | int | Content weight. A higher weight indicates a higher probability that the content is recommended. The value ranges from 1 to 100. If this parameter is not set, the default value 1 will be used. |
duration | No | int | Content duration, in seconds. |
author | No | String | Author. If multiple authors exist, separate them with commas (,). |
brief | No | String | Content description, such as the introduction, abstract, and body. The value can contain a maximum of 5000 characters. Extra characters will be truncated. |
keyword | No | String | Keyword. If multiple keywords exist, separate them with commas (,). |
language | No | String | Language code, in ISO 639-1 format, for example, zh and en. |
publish_time | No | long | Content publish time. The value is the total number of milliseconds since 1970-01-01 00:00:00. |
expire_time | No | long | Content expiration time. The value is the total number of milliseconds since 1970-01-01 00:00:00. If this parameter is not set, the content will never expire. |
last_modify_time | No | long | Last modification time. The value is the total number of milliseconds since 1970-01-01 00:00:00. |
ext_info | No | String | Extended field, which is a custom key-value pair. |
pv_cnt | No | long | Number of impressions in a month. |
click_cnt | No | long | Number of clicks in a month. |
like_cnt | No | long | Number of likes in a month. |
unlike_cnt | No | long | Number of dislikes in a month. |
comment_cnt | No | long | Number of comments in a month. |
collect_cnt | No | long | Number of favorites in a month. |
share_cnt | No | long | Number of shares in a month. |
download_cnt | No | long | Number of downloads in a month. |
tip_cnt | No | long | Number of rewards in a month. |
subscribe_cnt | No | long | Number of follows in a month. |
POST /analytics/datacollection/import/item 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":2,
"item_set":[
{
"id":"123",
"type":"video",
"status":1,
"name":"sea",
"category":"Stress relief",
"section":"XXX",
"weight":1,
"duration":200,
"author":"Jack,Rose",
"brief":"a love story",
"keyword":"sea,jump,boat",
"language":"en",
"publish_time":1623841189000,
"expire_time":1623841189000,
"last_modify_time":1623841189000,
"ext_info":{
"brand":"huawei",
"source":"vmall",
"price":200
},
"pv_cnt":100,
"click_cnt":100,
"like_cnt":100,
"unlike_cnt":100,
"comment_cnt":100,
"collect_cnt":100,
"share_cnt":100,
"download_cnt":100,
"tip_cnt":100,
"subscribe_cnt":100
},
{
"id":"456",
"type":"video",
"status":1,
"name":"cat",
"category":"Stress relief",
"section":"XXX",
"weight":1,
"duration":200,
"author":"Tom,Jerry",
"brief":"a love story",
"keyword":"cat,mouse",
"language":"en",
"publish_time":1623841189000,
"expire_time":1623841189000,
"last_modify_time":1623841189000,
"ext_info":{
"brand":"huawei",
"source":"vmall",
"price":200
},
"pv_cnt":100,
"click_cnt":100,
"like_cnt":100,
"unlike_cnt":100,
"comment_cnt":100,
"collect_cnt":100,
"share_cnt":100,
"download_cnt":100,
"tip_cnt":100,
"subscribe_cnt":100
}
]
} 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. |
HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Connection: Close
Content-Length: xxxx
{
"result_code":"0",
"result_msg":"success"
}