Skip to content

Đang tải lên tệp

Request

Đăng ký một tệp đã tải lên để cloud phone tải nó xuống.

  • Điều kiện tiên quyết: cloud phone phải đang bật và không bị thành viên khác chiếm giữ, và đối tượng phải đã tồn tại tại URL đó — dịch vụ sẽ kiểm tra nó và từ chối yêu cầu khi không đọc được. Tệp tải lên cho phát trực tiếp phải là MP4 và nhắm tới một dịch vụ thiết bị có hỗ trợ phát trực tiếp.
  • Hoàn tất: đã tiếp nhận, chưa hoàn tất. Phản hồi trả về fileId với trạng thái đang xử lý. Hãy hỏi vòng endpoint kết quả tải lên cho đến khi trạng thái là thành công hoặc thất bại.
  • Thử lại: không có cơ chế chống trùng; mỗi lần gọi tạo thêm một fileId.
  • Lưu ý về bề mặt API: trên Local API, đường dẫn này là một luồng multipart khác và cũ hơn. Tương đương của endpoint này trên Local API là /api/cloudphone/upload/file.

Các mã lỗi nghiệp vụ đã ghi nhận: 33401, 33419. Xem Error Codes để biết ý nghĩa từng mã. Mọi thao tác cũng có thể trả về các mã dùng chung.

Security
Authorization
Bodyapplication/jsonrequired
idstringrequired

Cloud phone ID

Example:"1661515884160372"
urlstringrequired

Object URL obtained from presignedUrl after the file bytes have been uploaded, or another publicly accessible download URL

Example:"https://storage.example.com/cloudphone/test.jpg"
uploadDeststringrequired

Upload destination directory

Example:"/Download"
uploadTypeinteger

File type (1 = regular file, 2 = MP4 live-streaming file)

Default:1
Enum:12
curl -i -X POST \
  https://api.morelogin.com/cloudphone/uploadFile \
  -H 'Authorization: Bearer <YOUR_JWT_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "id": "1661515884160372",
    "url": "https://storage.example.com/cloudphone/live-video.mp4",
    "uploadDest": "/Download",
    "uploadType": 2
  }'

Responses

Success. data is an object with the fields fileId, id and status.

Headers
any
Bodyapplication/json
codeintegerrequired
msgstring or nullrequired
dataobjectrequired
requestIdstringrequired
Response
{ "code": 0, "msg": null, "data": { "fileId": "1661515884160111", "id": "1661515884160372", "status": 1 }, "requestId": "1d4f3ea968664593860b94b35d4ebf5e" }