camera.uploadFile

该应用会向相机发出此命令,以开始将图片或视频从相机直接上传到服务器。相机应使用包含的参数形成 HTTP POST 请求。要上传的文件由 fileUrl 指定,应通过 accessToken 指定的正确授权将其上传到 uploadUrl此命令是在 API 级别 2.1 中添加的,与直接上传相关

您可以通过计算机命令行执行此操作,如下所示:

curl -X post -H "Authorization: Bearer accessToken" -T fileUrl uploadUrl

参数

  • fileUrl:要上传到服务器的文件的网址。
  • uploadUrl: 表示文件上传位置的字符串。
  • accessToken: 包含上传身份验证信息的令牌。该应用获取该应用并将其发送到相机。

成效

  • 此命令不会返回任何结果。

错误

  • missingParameter: 缺少某个参数,例如 fileUrl
  • invalidParameterName: 一个或多个输入参数名称无法识别。
  • invalidParameterValue: 可识别输入参数名称,但一个或多个传递的值无效。例如,fileUrl 指定的文件不存在。
  • uploadError:相机上传失败。
命令 I/O
命令输入
{
"parameters": {
"fileUrl": "URL of the file.",
"uploadUrl": "A string representing where to upload the file.",
"accessToken": "A token containing the authentication information."
}
}
命令输出
none
命令输出(错误)
{
"error": {
"code": "uploadError",
"message": "Camera failed to upload the file."
}
}