跳转到内容

上传文件

Request

登记一个已上传的文件,让云手机去下载它。

  • 前置条件:云手机必须已开机且未被其他成员占用,且该对象必须已经存在于给定 URL——服务会去探测它,读不到就拒绝请求。直播素材必须是 MP4,且目标机型需支持直播。
  • 完成信号已受理,未完成。 响应返回 fileId 和一个进行中状态;请轮询上传结果接口直到状态为成功或失败。
  • 重试:没有去重;每次调用都会产生一个新的 fileId
  • 接口面说明:在 Local API 上,这个路径是另一条较旧的分片上传流程。本接口在 Local API 上的等价物是 /api/cloudphone/upload/file

已记录的业务错误码:33401, 33419。 各错误码的含义见 Error Codes。任何接口还可能返回通用错误码。

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" }