camera.uploadFile
アプリはこのコマンドをカメラに発行して、画像のアップロードを開始します。
カメラからサーバーに直接送信できます。カメラは付属の
HTTP POST リクエストを形成します。アップロードするファイルは
fileUrl
です。正しいファイルを使用して uploadUrl
にアップロードする必要があります。
accessToken
で指定された認証。このコマンドは API レベルで追加されました。
2.1 で、これは
直接アップロード
これは、次のようにパソコンのコマンドラインから行うことができます。
curl -X post -H "Authorization: Bearer accessToken" -T fileUrl uploadUrl
パラメータ
fileUrl:
: サーバーにアップロードするファイルの URL。
uploadUrl:
: ファイルのアップロード先を表す文字列。
accessToken:
: 認証情報を含むトークン。
選択します。この情報はアプリによって取得され、カメラに送信されます。
結果
エラー
missingParameter:
一部のパラメータ(fileUrl
など)がありません。
invalidParameterName:
1 つ以上の入力パラメータ名が
認識されません。
invalidParameterValue:
入力パラメータ名が認識される
無効な値が 1 つ以上渡されました。たとえば、
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." } } |
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-08-21 UTC。
[null,null,["最終更新日 2024-08-21 UTC。"],[[["This command, available in API level 2.1 and later, allows apps to instruct the camera to directly upload images or videos to a server."],["The camera uses provided parameters (`fileUrl`, `uploadUrl`, `accessToken`) to form and send an HTTP POST request to the specified server."],["Direct Upload requires obtaining an access token and providing the file's URL and the server's upload URL within the command parameters."],["While the command itself returns no result, potential errors during the upload process can be indicated by specific error codes like `uploadError` or `invalidParameterValue`."]]],["The app directs the camera to upload a file to a server using an HTTP POST request. Key parameters include `fileUrl` (the file's location), `uploadUrl` (the destination), and `accessToken` (authorization token). The camera utilizes these parameters to perform the upload. No direct result is returned upon command execution, but error messages such as `missingParameter`, `invalidParameterValue` or `uploadError` will be returned if the command is not correctly executed. This feature was introduced in API level 2.1.\n"]]