Updated on 2025-04-22 GMT+08:00

Reporting Livestreaming Events

Function

Reports livestreaming events.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/smart-live-rooms/{room_id}/smart-live-jobs/{job_id}/live-event-report

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

room_id

Yes

String

Script ID.

job_id

Yes

String

Task ID.

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

auth_key

No

String

Authentication key. Authentication key generated using HMACSHA256.

expires_time

No

Long

Details:

Expiration time of the authentication key. Number of milliseconds that have elapsed since January 1, 1970 (midnight in UTC/GMT).

Value range:

0-4102415999000

refresh_url

No

Boolean

Whether to refresh the URL.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

No

String

User token. This parameter is mandatory when token authentication is used.

You can obtain the token by calling the IAM API used to obtain a user token.

Value of X-Subject-Token in the response header.

Authorization

No

String

Authentication information. This parameter is mandatory for AK/SK authentication.

X-Sdk-Date

No

String

Time when the request is sent. This parameter is mandatory for AK/SK authentication.

The format is YYYYMMDD'T'HHMMSS'Z'.

X-Project-Id

No

String

Project ID. This parameter is mandatory for AK/SK authentication.

X-App-UserId

No

String

Third-party user ID, which does not allow Chinese characters.

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

total

Yes

Integer

Details:

Number of events.

Value range:

1-1000

events

No

Array of LiveEvent objects

Event content.

review_config

No

ReviewConfig object

Content review configuration.

Table 5 LiveEvent

Parameter

Mandatory

Type

Description

timestamp

Yes

Long

Details:

Event timestamp. Number of milliseconds since 1970-01-01 00:00:00.

Value range:

0-4102415999000

type

No

Integer

Details:

Event type.

1: On-screen comment information

2: User joining a room

3: Liking

4: Sending gifts

5: Subscription/Following

6: Number of viewers in a room

Value range:

0-100

content

No

String

Event content.

The content varies according to the event type. The definition is as follows:

  • type=1 on-screen comment information

    Definition of content:

    • user: user, JSON

    • content: on-screen comment. The value is a string.

      Definition of user:

    • userId: user ID. The value is a string.

    • name: username. The value is a string.

    • level: user platform level. The value is an integer.

    • badge: user brand name. The value is a string.

    • badgeLevel: brand level. The value is an integer.

      For example:

    {
      "timestamp": 1694481224245,
      "type": 1,
      "content": "{\"user\":{\"userId\":\"2027271526\",\"name\":\"***\",\"level\":17,\"badge\":\"\",\"badgeLevel\":0},\"content\":\"***\"}"
    }
  • type=2 user joining a room

    Definition of content:

    • user: user, JSON

      For example:

    {
      "timestamp": 1694481227655,
      "type": 2,
      "content": "{\"user\":{\"userId\":\"2978899271\",\"name\":\"***\",\"level\":1,\"badge\":\"\",\"badgeLevel\":0}}"
    }
  • type=3 Liking

    Definition of content:

    • user: user, JSON

      For example:

    {
      "timestamp": 1694481227655,
      "type": 2,
      "content": "{\"user\":{\"userId\":\"2978899271\",\"name\":\"***\",\"level\":1,\"badge\":\"\",\"badgeLevel\":0}}"
    }
  • type=4 sending gifts

    Definition of content:

    • user: user, JSON

    • gift: gift information, JSON

      Definition of gift:

    • giftName: gift name. The value is a string.

    • giftNum: number of gifts. The value is an integer.

    • totalValue: total value of gifts. The value is an integer.

    • giftValue: value of one gift. The value is an integer.

      For example:

    {
      "timestamp": 1690531652862,
      "type": 4,
      "content": "{\"gift\":{\"giftName\":\"Star\",\"giftNum\":10,\"totalValue\":10,\"giftValue\":3},\"user\":{\"userId\":\"douyin_95882940927\",\"name\":\"Romantic lover\",\"level\":2,\"badge\":\"\",\"badgeLevel\":0}}"
    }
  • type=5 subscription

    Not used currently

  • type=6 number of viewers in a room

    Definition of content:

    • numberOfViewers: number of viewers in a room. The value is an integer.

      For example:

    {
      "timestamp": 1694481236886,
      "type": 6,
      "content": "{\"numberOfViewers\":5466}"
    }
Table 6 ReviewConfig

Parameter

Mandatory

Type

Description

no_need_review

No

Boolean

Content review whitelist. This feature is available only for users in the whitelist. The auto review policies apply to other users.

Response Parameters

Status code: 200

Table 7 Response header parameters

Parameter

Type

Description

X-Request-Id

String

Request ID.

Table 8 Response body parameters

Parameter

Type

Description

live_event_report_url

String

URL for uploading the updated livestreaming event.

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 401

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Status code: 500

Table 11 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error description.

Example Requests

POST https://{endpoint}/v1/70b76xxxxxx34253880af501cdxxxxxx/smart-live-rooms/24bad716-87b1-45e5-8912-6102f7693265/smart-live-jobs/26f06524-4f75-4b3a-a853-b649a21aaf66/live-event-report

{
  "total" : 1,
  "events" : [ {
    "timestamp" : 1690819199000,
    "type" : 1,
    "content" : "xxxxx"
  } ]
}

Example Responses

Status code: 200

Succeeded.

{
  "live_event_report_url" : "https://{endpoint}/v1/70b76xxxxxx34253880af501cdxxxxxx/smart-live-rooms/24bad716-87b1-45e5-8912-6102f7693265/smart-live-jobs/26f06524-4f75-4b3a-a853-b649a21aaf66/live-event-report"
}

Status code: 400

{
  "error_code" : "MSS.00000003",
  "error_msg" : "Invalid parameter"
}

Status code: 401

{
  "error_code" : "MSS.00000001",
  "error_msg" : "Unauthorized"
}

Status code: 500

{
  "error_code" : "MSS.00000004",
  "error_msg" : "Internal Error"
}

Status Codes

Status Code

Description

200

Succeeded.

400

Parameters error, including the error code and its description.

401

Authentication is not performed or fails.

500

Internal service error.

Error Codes

See Error Codes.