Polyv Help Center

Help Center

API for Obtaining STS Token for PPT Document Upload Under a Channel

Updated: 2022-05-24 09:38:10

API URL

http://api.polyv.net/live/v3/channel/document/get-server-token

API Description

1. Provides a server-side API for obtaining a token for uploading PPT documents.
2. Supports HTTPS.

Supported Format

JSON

Request Method

GET

Request Rate Limit

TRUE

Request Parameters

Parameter Required Type Description
appId Yes string Obtained from API settings, the appId registered in the live streaming system.
timestamp Yes string Current time in seconds (13-digit timestamp).
sign Yes string Signature, a 32-character uppercase MD5 value.
channelId Yes int Channel ID.
fileId Yes string File ID (Format: MD5 value of the generated file value1, channel ID value2, type string value3 (common for normal PPT, animate for animated PPT), fileId = value1 + value2 + value3). The value of value1 (i.e., the MD5 value of the file) can also be the MD5 value of the file name + file modification time. The file ID must be generated strictly according to this format to ensure uniqueness and the quick upload feature for the same file in the same channel.
fileName Yes string File name (including file extension, restricted to .ppt, .pptx, .pdf, .doc, .docx, .wps).
type Yes string File conversion type, "common" for normal PPT, "animate" for animated PPT.

Example of Successful Operation Response

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "encodedCallback": "eyJjYWxsYmFja1VybCI6Imh0dHA6Ly9kb2N1bWVudC0yLnBvbHl2Lm5ldC9hbGkvb3NzL2NhbGxiYWNrL3VwbG9hZCIsImNhbGxiYWNrSG9zdCI6ImRvY3VtZW50LTIucG9seXYubmV0IiwiY2FsbGJhY2tCb2R5Ijoib2JqZWN0PSR7b2JqZWN0fSZzaXplPSR7c2l6ZX0mYnVja2V0PSR7YnVja2V0fSZldGFnPSR7ZXRhZ30mYXV0b0lkPTQwNzMxMyZmaWxlSWQ9c3NkZGZkZGRkczMzIiwiY2FsbGJhY2tCb2R5VHlwZSI6ImFwcGxpY2F0aW9uL3gtd3d3LWZvcm0tdXJsZW5jb2RlZCJ9",
        "autoId": "407313",
        "expiration": "2019-07-17T04:36:26Z",
        "dir": "sources/20190717/",
        "token": "CAIS+gF1q6Ft5B2yfSjIr4neM4LXgopI2bO/MXeA1zgBQfob3rHOrjz2IH9LdHBtBOEasP4/nGtZ5/YflqQqFsEeHheYMJsutcQKqbp31RMW/p7b16cNrbH4M0rxYkeJ8a2/SuH9S8ynCZXJQlvYlyh17KLnfDG5JTKMOoGIjpgVBbZ+HHPPD1x8CcxROxFppeIDKHLVLozNCBPxhXfKB0ca0WgVy0EHsPvlmJbEtkCP3AWrl7BF/76ceMb0M5NeW75kSMqw0eBMca7M7TVd8RAi9t0t0/MUoGqa743DWQkJuETXY7fOlNp0N0pma6J/BrZAq/HwhTG5WjtoMmucGoABlIAZyelmx2YeNbHH4wEl9u6sN2AuCNyAYT2xTnRwgtvFlkblg2MC0lDLJcM4wI60pPCc+5qtOxU45AQH4T6EodUkBkCgHWk8q44MaYIhIsg3hOnJNTOouVRqanP+yWwirKszRIWiXF8naZ0aTHsrIQyIFONz9Cqyx8u8XTeihyQ=",
        "accessId": "STS.NJkx8coUinqT3Q138TMu71teF",
        "bucket": "polyvppt",
        "endpoint": "oss-cn-shenzhen.aliyuncs.com",
        "accessKey": "BbgS2wLdmXs2c91z269QPFXPZwScAG4qUy6TP1vPkd2D",
        "host": "http://polyvppt.oss-cn-shenzhen.aliyuncs.com",
        "callback": "{\"callbackUrl\":\"http://document-2.polyv.net/ali/oss/callback/upload\",\"callbackHost\":\"document-2.polyv.net\",\"callbackBody\":\"object=${object}&size=${size}&bucket=${bucket}&etag=${etag}&autoId=407313&fileId=ssddfdddds33\",\"callbackBodyType\":\"application/x-www-form-urlencoded\"}",
        "convertStatus": "waitUpload",
        "fileId": "ssddfdddds33",
        "object": "sources/20190717/ssddfdddds33.ppt"
    }
}

Example of Failed Operation Response

Signature Error

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

Missing parameter channelId

{
    "code": 400,
    "status": "error"
    "message": "param should not be empty: channelId",
    "data": ""
}

Invalid File ID

{
    "code": 400,
    "status": "error"
    "message": "illegal document fileId",
    "data": ""
}

Response Field Description

Name Type Description
code string Response code: 200 for success, 400 for failure, 403 for signature error, 500 for exception error.
status string "success" for success, "error" for failure.
message string Error message when an error occurs.
data string Successful response object.
data.convertStatus string PPT status: "normal" - no need to re-upload, an identical PPT has been successfully uploaded, can proceed to polling. "waitConvert" - PPT is being converted, an identical file is already being converted, proceed to polling. "waitUpload" - waiting for upload, proceed to upload to Alibaba Cloud.
data.autoId int Auto-incrementing file ID.
data.fileId string File ID.
data.accessId string OSS upload OSSAccessId.
data.accessKey string OSS upload OSSAccessKey.
data.dir string Folder for uploading to OSS.
data.endpoint string OSS upload endpoint.
data.bucket string OSS upload bucket.
data.host string OSS upload host.
data.expiration string Expiration time of the encrypted string.
data.callback string OSS upload callback parameter (must be included to notify the backend of the upload status).
data.encodedCallback string OSS upload callback parameter using encode encoding (must be included when uploading to OSS to notify the backend of the upload status).
data.object string Document storage directory key.
联系客服,在线咨询