P2P Streaming Engine

vuePress-theme-reco    2018 - 2021
P2P Streaming Engine P2P Streaming Engine

Choose mode

  • dark
  • auto
  • light
Documents
  • Introduction
  • Web SDK

    • Hls.js
    • Dash.js
    • Shaka-Player
    • MP4
    • Downloader
  • Android SDK
  • iOS SDK
  • Flutter SDK
Pricing
Contact Us
Partnership
Console
GitHub
语言
  • English
  • 简体中文

Documents
  • Introduction
  • Web SDK

    • Hls.js
    • Dash.js
    • Shaka-Player
    • MP4
    • Downloader
  • Android SDK
  • iOS SDK
  • Flutter SDK
Pricing
Contact Us
Partnership
Console
GitHub
语言
  • English
  • 简体中文
  • Introduction
  • FAQ
  • Tracking Service
  • Signaling Service
  • P2P Optimization
  • Console

    • Domain/AppId Binding
    • Data Analysis
    • P2P Control
    • Restful API
      • BASE URL
      • Get Token
      • Get Domain List
      • Get Realtime Information
      • Get Historical P2P Traffic
      • Get Historical Online Viewers
      • Enable/Disable P2P
  • Hls.js SDK

    • Introduction
    • Usage
    • Player Integration
    • API & Config
    • CDN
    • Change Log
  • Android SDK

    • Introduction
    • Usage
    • API & Config
    • Change Log
  • iOS SDK

    • Introduction
    • Usage
    • API & Config
    • Change Log
  • Flutter SDK

    • Introduction
    • Usage
    • API & Config
    • Change Log
  • Shaka-Player SDK

    • Introduction
    • Usage
    • Player Integration
    • API & Config
    • Change Log
  • Web MP4 SDK

    • Introduction
    • Usage
    • Player Integration
    • API & Config
    • Change Log
  • Dash.js SDK

    • Introduction
    • Usage
    • Player Integration
    • API & Config
    • Change Log
  • Web Downloader

    • Introduction
    • Usage
    • API & Config
    • Change Log
  • Android SDK 1.x

    • Introduction
    • Usage
    • API & Config
    • Change Log
  • More

    • Design

Restful API

vuePress-theme-reco    2018 - 2021

Restful API


# BASE URL

  • Chinese cluster https://cgi.cdnbye.com:6067/v1
  • American cluster https://cgi.hdtvcloud.com:6067/v1
    Rate limiting: 20 requests per second

# Get Token

You can use this API to get the token with your account

POST /user/token

# POST Body

Name Type Description Required
email string User email Yes
passwd string The sha256 encrypted string of raw password Yes

# Response

Status: 200

{
  "ret": 0,
  "name": "token",
  "data":
    {
      "id": 001,
      "token": "xxxxxx"
    }
}
Name Type Description
id int User ID
token string User token, will expire in 7days

# Get Domain List

You can use this API to get all domain/APP list of a user

GET /user/user_id/{user_id}/domain

# HTTP Header

Name Type Description Required
MyToken string The token of user Yes

# Query

Name Type Description Required
page int The specific page number Yes
page_size int The specific page size Yes

# Response

Status: 200

{
  "ret": 0,
  "name": "domain"
  "data":
    [
      {
        "id": 001,
        "domain": "xxx.com",
        "uid": 001,
        "native": false,
        "isValid": false
      }
    ]
}
Name Type Description
id int Domain/APP ID
domain string Domain name or AppId
uid int User ID
native bool Is native application
isValid bool Is domain verified

# Get Realtime Information

You can use this API to get realtime information of a specific domain/APP

GET /user/user_id/{user_id}/domain/domain_id/{domain_id}

# HTTP Header

Name Type Description Required
MyToken string The token of user Yes

# Path Parameters

Name Type Description Required
user_id string User ID Yes
domain_id string Domain ID Yes

# Response

Status: 200

{
  "ret": 0,
  "name": "domain",
  "data":
    {
      "num_rt": 456,
      "num_max": 892,
      "traffic_p2p_day": 1022794195,
      "api_frequency_day": 14805,
     }
}
Name Type Description
num_rt int Current Online Viewers
num_max int Peak Concurrent Viewers
traffic_p2p_day int P2P Traffic Today (KB)
api_frequency_day int Playback Sessions Today

# Get Historical P2P Traffic

You can use this API to get historical p2p traffic for a specific time period

GET /user/user_id/{user_id}/domain/domain_id/{domain_id}/p2p

# HTTP Header

Name Type Description Required
MyToken string The token of user Yes

# Path Parameters

Name Type Description Required
user_id string User ID Yes
domain_id string Domain ID Yes

# Query

Name Type Description Required
start_ts int The start timestamp(UTC+8) Yes
end_ts int The end timestamp(UTC+8) Yes
gran int Always equal to 1440 Yes

# Response

Status: 200

{
  "ret": 0,
  "name": "statistic",
  "data":
    {
      "max":
        {
          "ts": 1591372800,
          "value": 541188637412
        },
        "list":
          [
            {"ts":1590854400,"value":1591200000},
            {"ts":1590940800,"value":194511284034},
            {"ts":1591027200,"value":541188637412}
          ]
    }
}
Name Type Description
max object The max value of all data
list array The array of all data
ts int Timestamp
value int P2P traffic(KB)

# Get Historical Online Viewers

You can use this API to get historical online viewers for a specific time period

GET /user/user_id/{user_id}/domain/domain_id/{domain_id}/num

# HTTP Header

Name Type Description Required
MyToken string The token of user Yes

# Path Parameters

Name Type Description Required
user_id string User ID Yes
domain_id string Domain ID Yes

# Query

Name Type Description Required
start_ts int The start timestamp(UTC+8) Yes
end_ts int The end timestamp(UTC+8) Yes
gran int Must be an integer multiple of 5 minutes Yes

# Response

Status: 200

{
  "ret": 0,
  "name": "statistic",
  "data":
    {
      "max":
        {
          "ts": 1591372800,
          "value": 109566
        },
        "list":
          [
            {"ts":1590854400,"value":66504},
            {"ts":1590940800,"value":72373},
            {"ts":1591027200,"value":78300}
          ]
    }
}
Name Type Description
max object The max value of all data
list array The array of all data
ts int Timestamp
value int Online viewers

# Enable/Disable P2P

If you bind multiple domain names/APPID in one account, those which open P2P services share traffic packets together. You can save on packet consumption by shutting down P2P services of one or several domain names.

POST /user/user_id/{user_id}/domain/domain_id/{domain_id}/control

# HTTP Header

Name Type Description Required
MyToken string The token of user Yes

# Path Parameters

Name Type Description Required
user_id string User ID Yes
domain_id string Domain ID Yes

# POST Body

Name Type Description Required
disable bool Set true disable p2p or false to enable p2p Yes

# Response

Status: 200

{
  "ret":0,
  "name":"control",
  "data":
    {
      "allow":true,
      "succeed":true
    }
}