GetPublishCode

Update time: 2024-07-29 17:11:02

You can obtain the url of the multi-resolution video playback, and users can watch the video directly through the url.

  • Limit of request rate per user: 300/5min
  • Applicable Products: Cloud VoD
For API authentication details, please refer to: API Authentication Overview

Request

Body Params

NameDescription
*videoIdString

Video ID

codeTypeInteger

Play code type Value range: 0(all) 2(swf code) 4(Video URL) 5(Adaptive code) 6(Try watch video URL) 7(Try watch adaptive code) 8(The customized encrypted play code) The default is 0; General licensed video only has adaptive/video URL. Normal encrypted video only swf/ customer custom/video URL. Non-encrypted video only has swf/ Adaptive/Custom/video URL

Response

Body Params

NameDescription
codeInteger

Status code

dataObject
videoIdString

videoId

encryptInteger

Whether the video is encrypted Value range: 0(unencrypted) 1(encryption)

autoCodeString

Video adaptive code, encrypted video is empty

swfCodeString

Video swf code

customCodeString

Custom play code. The default value is null. If you have personalized needs, please contact customer service.

videoUrlList
fluentUrlString

Smooth bit rate video url

hdPullUrlString

Ultra clear bit rate video url

highUrlString

Hd bit rate video url

originUrlString

Original video url

sdUrlString

Standard definition bit rate video url

urlTypeString

PC/mobile terminal

messageString

message

Error code

Error code(code)Description(message)HTTP statusSemantic
1503

The videoId cannot be empty

200The videoId cannot be empty
1504

videoId contains special characters

200videoId contains special characters
1532

codeType is invalid

200codeType is invalid
1502

The video doesn't exist!

200The video doesn't exist!
1535

No permission to get publish code

200No permission to get publish code

Example

JSON
JSON
Request example
Copy Copy success
#!/bin/bash
username='example_username'
apiKey='example_apiKey'
date=`env LANG="en_US.UTF-8" date -u "+%a, %d %b %Y %H:%M:%S GMT"`
password=`echo -en "$date" | openssl dgst -sha1 -hmac $apiKey -binary | openssl enc -base64`
curl -i --url "https://api.cdnetworks.com/vod/videoManage/getPublishCode" \
-X "POST" \
-u "$username:$password" \
-H "Date: $date" \
-H "x-cnc-auth-method: BASIC" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
    "videoId": "9B0F7BA8BCB9D056D4C24ADDBF821D10",
    "codeType": 0
}'
Response example
Copy Copy success
{
    "code": 200,
"data": {
"videoId ": 8731c067016b1000d7d05b5600000000,
        "encrypt": 0,
        “autoCode”:” https://cloudv.chinanetcenter.com/player/auto-play.action?videoId=9B0F7BA8BCB9D056D4C24ADDBF821D10&userId=6A313F452ADC20F7&playerType=11”,
        "swfCode": "https://cloudv.chinanetcenter.com/swf/player/6A313F452ADC20F7_9B0F7BA8BCB9D056D4C24ADDBF821D10_true_11/StrobeMediaPlayback.swf",
        "customCode": "",	
        "videoUrl": [
            {
                "fluentUrl": "",
                "hdPullUrl": "",
                "highUrl": "",
                "originUrl": "http://live.ovptest.haplat.net/live/201708/4101630234a74ee8864e56ea88e5d290_20170801171220/4101630234a74ee8864e56ea88e5d290_20170801171220_live2vod.mp4",
                "sdUrl": "",
                "urlType": "PC"
            },
            {
                "fluentUrl": "",
                "hdPullUrl": "",
                "highUrl": "",
                "originUrl": "http://live.ovptest.haplat.net/live/201708/4101630234a74ee8864e56ea88e5d290_20170801171220/4101630234a74ee8864e56ea88e5d290_20170801171220_live2vod.mp4",
                "sdUrl": "",
                "urlType": "PC"
            }
        ]
    },
    "message": "Operation succeeded"
}
Is the content of this document helpful to you?
Yes
I have suggestion
Submitted successfully! Thank you very much for your feedback, we will continue to strive to do better!