Skip to content

API for LIVE resource

Description

This section describes API methods for creating, deleting and configurations changing of your resources. You will also find here the information on cache managing and statistical data receiving.

All the responses (including errors) return in JSON Format.

Attention!

You can make not more than 5 API requests every minute.

Find below examples for monitoring and configuring of the options in connection with Live streaming service.

Configuration for LIVE Resource

RTMP/RTSP-publish

Get all resources

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

  • Method: GET
  • Headers: CDN-AUTH-TOKEN
  • Response Data Type: JSON Array or JSON Object in case of error
Status Code Response Data Response Format Description
200 All live resources configured in specified account or error description JSON Response with list of resources or error
403 None None Forbidden
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_OSKVHEJCGDOPEQJJXQN284ZTQUEPJ2' https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/

Successful response example

[
  {
    "name": "test_resource",
    "settings": {
      "RTMP-publish": {
        "domain": "p0q2zwj4yih.a.trbcdn.net",
        "pub_protocol": "rtmp",
        "master_stream": "jws2w_test_resource.smil",
        "primary": "a.r.cdnvideo.net",
        "application": "livemaster",
        "dist_protocol": "https",
        "backup": "b.r.cdnvideo.net"
      }
    },
    "streams": {
      "RANDOM01": {
        "stream_name": "RANDOM01_stream01",
        "password": "RtdHESB7aA7rdKDCuVYn5W9Zp",
        "resolution": "720p",
        "name": "stream01",
        "smil": {
          "BANDWIDTH": "5000000",
          "RESOLUTION": "1280x720"
        }
      },
      "RANDOM02": {
        "stream_name": "RANDOM02_stream02",
        "password": "dRKLVu6v90P5PhSAMIGSIgKuh",
        "resolution": "1080p",
        "name": "stream02",
        "smil": {
          "BANDWIDTH": "10000000",
          "RESOLUTION": "1920x1080"
        }
      }
    },
    "active": true,
    "creation_ts": 1542872090,
    "type": "RTMP-publish",
    "id": "1163546047721937079_p0q2zwj4yih",
    "resources": {
      "http": "p0q2zwj4yih"
    },
    "description": ""
  }
]

Unsuccessful response example

{"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}

Attention

To get deactivated resources, use the query parameter "active" with the value "false"

Get specific resource

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

  • Method: GET
  • Headers: CDN-AUTH-TOKEN
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 Live resource configured in specified account or error description JSON Response with resource or error
403 None None Forbidden
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_OSKVHEJCGDOPEQJJXQN284ZTQUEPJ2' https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/1163546047721937079_p0q2zwj4yih

Successful response example

{
  "name": "test_resource",
  "settings": {
    "RTMP-publish": {
      "domain": "p0q2zwj4yih.a.trbcdn.net",
      "pub_protocol": "rtmp",
      "master_stream": "jws2w_test_resource.smil",
      "primary": "a.r.cdnvideo.net",
      "application": "livemaster",
      "dist_protocol": "https",
      "backup": "b.r.cdnvideo.net"
    }
  },
  "streams": {
    "RANDOM01": {
      "stream_name": "RANDOM01_stream01",
      "password": "RtdHESB7aA7rdKDCuVYn5W9Zp",
      "resolution": "720p",
      "name": "stream01",
      "smil": {
        "BANDWIDTH": "5000000",
        "RESOLUTION": "1280x720"
      }
    },
    "RANDOM02": {
      "stream_name": "RANDOM02_stream02",
      "password": "dRKLVu6v90P5PhSAMIGSIgKuh",
      "resolution": "1080p",
      "name": "stream02",
      "smil": {
        "BANDWIDTH": "10000000",
        "RESOLUTION": "1920x1080"
      }
    }
  },
  "active": true,
  "creation_ts": 1542872090,
  "type": "RTMP-publish",
  "id": "1163546047721937079_p0q2zwj4yih",
  "resources": {
    "http": "p0q2zwj4yih"
  },
  "description": ""
}

Unsuccessful response example

{"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}

Attention

To get deactivated resource, use the query parameter "active" with the value "false"

Create resource

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

  • Method: POST
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with resource data
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X POST
  -d '{"name": "test_resource", "type": "RTMP-publish", "streams": {"RANDOM01": {"name": "stream01", "resolution": "720p"}, "RANDOM02": {"name": "stream02", "resolution": "1080p"}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/

Successful response example

{
  "status": "accept",
  "task_id": "20181122103450831469",
  "resource_id": "1163546047721937079_p0q2zwj4yih"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}

Update resource

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

  • Method: PATCH
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with new resource data
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id or error description JSON Updated, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X PATCH
  -d '{"name": "test_resource", "type": "RTMP-publish", "streams": {"RANDOM01": {"name": "stream01", "resolution": "360p"}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/1163546047721937079_p0q2zwj4yih

Successful response example

{
  "status": "accept",
  "task_id": "20181122103856008585"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}

Deactivate resource

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

  • Method: PATCH
  • Headers: CDN-AUTH-TOKEN
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id or error description JSON Deactivated, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X PATCH
  -d '{"active": false, "name": "test_resource", "type": "RTMP-publish", "streams": {"RANDOM01": {"name": "stream01", "resolution": "360p"}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/1163546047721937079_p0q2zwj4yih

Successful response example

{
  "status": "accept",
  "task_id": "20181122103856008586"
}

Unsuccessful response example

{"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}

Activate resource

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

  • Method: PATCH
  • Headers: CDN-AUTH-TOKEN
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id or error description JSON Activated, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X PATCH
  -d '{"active": true, "name": "test_resource", "type": "RTMP-publish", "streams": {"RANDOM01": {"name": "stream01", "resolution": "360p"}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/1163546047721937079_p0q2zwj4yih

Successful response example

{
  "status": "accept",
  "task_id": "20181122103856008586"
}

Unsuccessful response example

{"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}

Local authorization

Create resource with local authorization

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

  • Method: POST
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with resource data and local authorization parameters
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X POST
  -d '{"auth": {"md5": {"secret": "123", "forever": true, "anywhere": true}}, "name": "test_resource", "type": "RTMP-publish", "streams": {"RANDOM01": {"name": "stream01", "resolution": "720p"}, "RANDOM02": {"name": "stream02", "resolution": "1080p"}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/

Successful response example

{
  "status": "accept",
  "task_id": "20181122103450831469",
  "resource_id": "1163546047721937079_p0q2zwj4yih"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}

Update resource local authorization

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

  • Method: PATCH
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with new parameters of local authorization
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id or error description JSON Updated, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X PATCH
  -d '{"auth": {"md5": {"secret": "456", "forever": true}}, "name": "test_resource", "type": "RTMP-publish", "streams": {"RANDOM01": {"name": "stream01", "resolution": "360p"}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/1163546047721937079_p0q2zwj4yih

Successful response example

{
  "status": "accept",
  "task_id": "20181122103856008585"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}

External authorization

Create resource with external authorization

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

  • Method: POST
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with resource data and external authorization parameters
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X POST
  -d '{"auth": {"url": "https://test.com/yourscript"}, "name": "test_resource", "type": "RTMP-publish", "streams": {"RANDOM01": {"name": "stream01", "resolution": "720p"}, "RANDOM02": {"name": "stream02", "resolution": "1080p"}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/

Successful response example

{
  "status": "accept",
  "task_id": "20181122103450831469",
  "resource_id": "1163546047721937079_p0q2zwj4yih"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}

Update resource external authorization

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

  • Method: PATCH
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with new parameters of external authorization
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id or error description JSON Updated, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X PATCH
  -d '{"auth": {"url": "https://test.com/yourscript2"}, "name": "test_resource", "type": "RTMP-publish", "streams": {"RANDOM01": {"name": "stream01", "resolution": "360p"}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/1163546047721937079_p0q2zwj4yih

Successful response example

{
  "status": "accept",
  "task_id": "20181122103856008585"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}

To receive the full publication links, you have to combine live resource parameters, received via GET-request.

<pub_protocol>://<primary|backup>/<application>/<stream_name>?auth=<password>

Example of final link for publishing:

rtmp://a.r.cdnvideo.net/livemaster/RANDOM01_stream01?auth=MkE5MGtjbPljT52t491y6z14C

<dist_protocol>://<domain>/<application>/<master_stream>/playlist.m3u8

Example of final link for streaming:

https://p0q2zwj4yih.a.trbcdn.net/livemaster/jws2w_test_resource.smil/playlist.m3u8

Transcoding

You can order the service of transcoding the input stream in several qualities. This will reduce the cost of hardware or software.

Important!

This service is paid according to the tariffs indicated in dashboard.

Transcoding profiles

We offer the following transcoding profiles:

Profile ID Qualities Video codec Audio codec Combining qualities into one stream
360_480_720 360p, 480p, 720p h.264 AAC/mp3 +
480_720_1080 480p, 720p, 1080p h.264 AAC/mp3 +
360_480_720_1080 360p, 480p, 720p, 1080p h.264 AAC/mp3 +
Order the service

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

  • Method: POST
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with resource data and selected transcoding profile
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X POST
  -d '{"name": "test_resource", "transcode_profile": "360_480_720", "type": "RTMP-publish", "streams": {"RANDOM01": {"name": "stream01", "resolution": "720p"}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/

Successful response example

{
  "status": "accept",
  "task_id": "20181122103450831469",
  "resource_id": "1163546047721937079_p0q2zwj4yih"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "transcode_profile should be one of ['480_720_1080', '360_480_720', '360_480_720_1080']. Not 360_480"}

Attention

If you order a transcoding service, then you should specify ONLY ONE input stream.

Change the service

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

  • Method: PATCH
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with resource data and new transcoding profile
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id or error description JSON Updated, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X PATCH
  -d '{"name": "test_resource", "transcode_profile": "360_480_720_1080", "type": "RTMP-publish", "streams": {"RANDOM01": {"name": "stream01", "resolution": "720p"}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/1163546047721937079_p0q2zwj4yih

Successful response example

{
  "status": "accept",
  "task_id": "20181122103450831471"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "there must be only one stream to be transcoded. Not 0"}

Attention

If you order a transcoding service, then you should specify ONLY ONE input stream.

Deactivate the service

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

  • Method: PATCH
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with resource data and empty transcoding profile
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id or error description JSON Updated, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X PATCH
  -d '{"name": "test_resource", "transcode_profile": "", "type": "RTMP-publish", "streams": {"RANDOM01": {"name": "stream01", "resolution": "720p"}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/1163546047721937079_p0q2zwj4yih

Successful response example

{
  "status": "accept",
  "task_id": "20181122103450831472"
}

Unsuccessful response example

{"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}

HLS-cache

Get all resources

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

  • Method: GET
  • Headers: CDN-AUTH-TOKEN
  • Response Data Type: JSON Array or JSON Object in case of error
Status Code Response Data Response Format Description
200 All live resources configured in specified account or error description JSON Response with list of resources or error
403 None None Forbidden
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_OSKVHEJCGDOPEQJJXQN284ZTQUEPJ2' https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/

Successful response example

[
  {
    "origin": {
      "https": true,
      "servers": {
        "yourdomain.com": {
          "backup": false,
          "port": 80,
          "weight": 1
        }
      }
    },
    "cdn_domain": "wtx3l7rtrl6.a.trbcdn.net",
    "name": "live-qxthy19jjz",
    "streams": {
      "2it9dwypm4": {
        "id": "/stream/playlist.m3u8"
      }
    },
    "names": ["test.cname.com"],
    "active": true,
    "creation_ts": 1551853456,
    "type": "HLS-cache",
    "id": "8053158264585032642_wtx3l7rtrl6",
    "resources": {
      "http": "wtx3l7rtrl6"
    },
    "description": ""
  }
]

Unsuccessful response example

{"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}

Attention

To get deactivated resources, use the query parameter "active" with the value "false"

Get specific resource

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

  • Method: GET
  • Headers: CDN-AUTH-TOKEN
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 Live resource configured in specified account or error description JSON Response with resource or error
403 None None Forbidden
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_OSKVHEJCGDOPEQJJXQN284ZTQUEPJ2' https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/8053158264585032642_wtx3l7rtrl6

Successful response example

{
  "origin": {
    "https": true,
    "servers": {
      "yourdomain.com": {
        "backup": false,
        "port": 80,
        "weight": 1
      }
    }
  },
  "cdn_domain": "wtx3l7rtrl6.a.trbcdn.net",
  "name": "live-qxthy19jjz",
  "streams": {
    "2it9dwypm4": {
      "id": "/stream/playlist.m3u8"
    }
  },
  "names": ["test.cname.com"],
  "active": true,
  "creation_ts": 1551853456,
  "type": "HLS-cache",
  "id": "8053158264585032642_wtx3l7rtrl6",
  "resources": {
    "http": "wtx3l7rtrl6"
  },
  "description": ""
}

Unsuccessful response example

{"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}

Attention

To get deactivated resource, use the query parameter "active" with the value "false"

Create resource

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

  • Method: POST
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with resource data
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X POST
  -d '{"name": "live-qxthy20jjz", "type": "HLS-cache", "streams": {"3it9dwypm4": {"id": "/stream/playlist.m3u8"}}, "origin": {"https": false, "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}, "names": ["test-cname.com"]}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/

Successful response example

{
  "status": "accept",
  "task_id": "20190305103450831469",
  "resource_id": "9282601590143242685_pqy19d9z3pm"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}

Update resource

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

  • Method: PATCH
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with new resource data
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id or error description JSON Updated, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X PATCH
  -d '{"name": "live-qxthy20jjz-2", "type": "HLS-cache", "streams": {"4it9dwypm4": {"id": "/stream/playlist-2.m3u8"}}, "origin": {"https": false, "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/9282601590143242685_pqy19d9z3pm

Successful response example

{
  "status": "accept",
  "task_id": "20190305103450831470"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}

Deactivate resource

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

  • Method: PATCH
  • Headers: CDN-AUTH-TOKEN
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id or error description JSON Deactivated, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X PATCH
  -d '{"active": false, "name": "live-qxthy20jjz-2", "type": "HLS-cache", "streams": {"4it9dwypm4": {"id": "/stream/playlist-2.m3u8"}}, "origin": {"https": false, "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/9282601590143242685_pqy19d9z3pm

Successful response example

{
  "status": "accept",
  "task_id": "20190305103450831479"
}

Unsuccessful response example

{"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}

Activate resource

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

  • Method: PATCH
  • Headers: CDN-AUTH-TOKEN
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id or error description JSON Activated, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X PATCH
  -d '{"active": true, "name": "live-qxthy20jjz-2", "type": "HLS-cache", "streams": {"4it9dwypm4": {"id": "/stream/playlist-2.m3u8"}}, "origin": {"https": false, "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/9282601590143242685_pqy19d9z3pm

Successful response example

{
  "status": "accept",
  "task_id": "20190305103450831479"
}

Unsuccessful response example

{"status": "error", "message": "Not allowed method", "description": "Request is forbidden"}

Local authorization

Create resource with local authorization

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

  • Method: POST
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with resource data and local authorization parameters
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X POST
  -d '{"auth": {"md5": {"secret": "123", "forever": true, "anywhere": true}}, "name": "live-qxthy20jjz", "type": "HLS-cache", "streams": {"3it9dwypm4": {"id": "/stream/playlist.m3u8"}}, "origin": {"https": false, "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}, "names": ["test-cname.com"]}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/

Successful response example

{
  "status": "accept",
  "task_id": "20190305103450831469",
  "resource_id": "9282601590143242685_pqy19d9z3pm"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}

Update resource local authorization

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

  • Method: PATCH
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with new parameters of local authorization
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id or error description JSON Updated, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X PATCH
 -d '{"auth": {"md5": {"secret": "456", "forever": true}}, "name": "live-qxthy20jjz-2", "type": "HLS-cache", "streams": {"4it9dwypm4": {"id": "/stream/playlist-2.m3u8"}}, "origin": {"https": false, "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/9282601590143242685_pqy19d9z3pm

Successful response example

{
  "status": "accept",
  "task_id": "20190305103450831470"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}

External authorization

Create resource with external authorization

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/

  • Method: POST
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with resource data and external authorization parameters
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id, resource_id or error description JSON Created, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X POST
  -d '{"auth": {"url": "https://test.com/yourscript"}, "name": "live-qxthy20jjz", "type": "HLS-cache", "streams": {"3it9dwypm4": {"id": "/stream/playlist.m3u8"}}, "origin": {"https": false, "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}, "names": ["test-cname.com"]}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/

Successful response example

{
  "status": "accept",
  "task_id": "20190305103450831469",
  "resource_id": "9282601590143242685_pqy19d9z3pm"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "required key name isn't provided"}

Update resource external authorization

URL: https://api.cdnvideo.ru/cdn/api/v1/<your_account_name>/resource/live/<resource_id>

  • Method: PATCH
  • Headers: CDN-AUTH-TOKEN
  • Request Data: JSON with new parameters of external authorization
  • Response Data Type: JSON Object
Status Code Response Data Response Format Description
200 task_id or error description JSON Updated, id of task in global task queue or error
400 None None Bad Request
404 None None Not Found
500 None None Internal Server Error
503 None None Service Unavailable

Request example

curl -H 'cdn-auth-token:cdn2_2YXPIWIYRT15SZGQ2Q0JN362PUDXIE'
  -X PATCH
 -d '{"auth": {"url": "https://test.com/yourscript2"}, "name": "live-qxthy20jjz-2", "type": "HLS-cache", "streams": {"4it9dwypm4": {"id": "/stream/playlist-2.m3u8"}}, "origin": {"https": false, "servers": {"yourdomain.com": {"port": 80, "weight": 1, "backup": false}}}}'
  https://api.cdnvideo.ru/cdn/api/v1/paejgjuv/resource/live/9282601590143242685_pqy19d9z3pm

Successful response example

{
  "status": "accept",
  "task_id": "20190305103450831470"
}

Unsuccessful response example

{"status": "error", "message": "Json invalid", "description": "stream key length should be between 5 and 10. Not 17"}

To receive the full streaming links, you have to combine live resource parameters, received via GET-request.

<pub_protocol>://<cdn_domain>/<stream_id>
<pub_protocol>://<names>/<stream_id>

Example of final CDN-links:

https://wtx3l7rtrl6.a.trbcdn.net/stream/playlist.m3u8
https://test.cname.com/stream/playlist.m3u8