Last update:2023-01-29 17:42:32
After obtaining URL and credential(token) of the video, audio or material , you can call this API to upload the video, audio or material to Cloud VoD.
You should use multpart upload if the file size exceeds 2GB.
Request Method | POST |
---|---|
URL | <uploadUrl>/file/upload |
The uploadUrl can be obtained from Get Upload Token API.
Parameter | Required | Description |
---|---|---|
Content-Type | Yes | For this API, The Content-Type header must be in the multipart/form-data;boundary=xxxxxx format.The boundary is a string that is randomly generated by the form. No need to specify the boundary yourself. |
Content-Length | Yes | the size of the message body, in bytes. |
Parameter | Type | Required | Description |
---|---|---|---|
token | Text | Yes | The token obtained from Get Upload Token API. |
file | File | Yes | The file content. |
If the request is successful, you can see the response as following
{“hash”:“<hash string>”,“response”:"{\“success\”:0}"}
The hash in response is a URL Safe Base64 String which indicates the hash value of the file.
If the request is failed, the response will be as following:
{
"code": "<error code>",
"message": "<message>"
}
curl -X POST \
https://upload.cloudv.haplat.net/file/upload \
-H ‘cache-control: no-cache’ \
-H ‘content-type: multipart/form-data;
boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW’ \
-F file=@1b095d2c66034d6bb3d74fa4e306bf4c20171122162359.jpeg \
-F
token=7e7dae54118c45a6ffd213a18c9d4847b51a73f1:M2Q4ODczNzU0YjY2NzQ1YTEwNzZmOGNlODQ3ZDZiOWE3MDk0NTlhNQ==:eyJzY29wZSI6ImNsb3Vkdi1kb2M6MTYwNjEyL292cHRlc3QvMjAxODAzLzZhYTg0YzkyMDE2MjEwMDA1YmY3OGUzNjAwMDAwMDAwLzZhYTg0YzkyMDE2MjEwMDA1YmY3OGUzNjAwMDAwMDAwLnBkZiIsImRlYWRsaW5lIjoiMjUyNDYyMjQwMDAwMCIsIm92ZXJ3cml0ZSI6MSwiZnNpemVMaW1pdCI6MCwiY2FsbGJhY2tVcmwiOiJodHRwOi8vMTExLjIwNi4yMTkuMjM1L2NhbGxiYWNrL2NhbGxiYWNrIWRvY3VtZW50VXBsb2FkQ2FsbGJhY2suYWN0aW9uIiwiY2FsbGJhY2tCb2R5IjoiJmJ1Y2tldD0kKGJ1Y2tldCkma2V5PSQoa2V5KSZmbmFtZT0kKGZuYW1lKSZmc2l6ZT0kKGZzaXplKSZtaW1lVHlwZT0kKG1pbWVUeXBlKSZ1cmw9JCh1cmwpJmlwPSQoaXApJmNvc3RUaW1lPSQoY29zdFRpbWUpJmRvY3VtZW50SWQ9NmFhODRjOTIwMTYyMTAwMDViZjc4ZTM2MDAwMDAwMDAmY3VzdG9tZXJJZD0xNjA2MTImdXNlck5hbWU9YjNad2RHVnpkQT09JmZpbGVOYW1lPVptbHNaVTVoYldVek1UUnVielE9JmRvY3VtZW50VHlwZT0xJnRhc2tGbGFnPTEmdGFza0RldGFpbElkPTZhYTg0YzkyMDE2MjEwMDA2YzZhMWE5MzAwMDAwMDAwJmZpbGVGdWxsVXJsPU1UWXdOakV5TDI5MmNIUmxjM1F2TWpBeE9EQXpMelpoWVRnMFl6a3lNREUyTWpFd01EQTFZbVkzT0dVek5qQXdNREF3TURBd0x6WmhZVGcwWXpreU1ERTJNakV3TURBMVltWTNPR1V6TmpBd01EQXdNREF3TG5Ca1pnPT0ifQ==
Here we list some dedicated error codes for this API. If you want more details about the error code, visit Common Responses.
Error Code | Message |
---|---|
400 | File Transmission Fail |
401 | Token Invalid |
401 | Token Format Invalid |
401 | Token Expired |
401 | Upload File Cannot be Empty |
401 | File Too Large |
405 | Token Required |
500 | Internal Server Error |
579 | Callback Failed |