camera.uploadFile
Stay organized with collections
Save and categorize content based on your preferences.
The app issues this command to the camera to initiate upload of an image or
video directly from the camera to a server. The camera should use the included
parameters to form an HTTP POST request. The file to be uploaded is specified by
fileUrl
and it should be uploaded to uploadUrl
with the correct
authorization specified by accessToken
. This command was added in API level
2.1 and is relevant to
Direct Upload
One could do this from a computer command line as:
curl -X post -H "Authorization: Bearer accessToken" -T fileUrl uploadUrl
Parameters
fileUrl:
The URL of the file to be uploaded to the server.
uploadUrl:
A string representing where to upload the file.
accessToken:
A token including the authentication information for the
upload. It is obtained by the app and sent to the camera.
Results
- This command returns no result.
Errors
missingParameter:
Some parameter, for example, fileUrl
is missing.
invalidParameterName:
One or more input parameter names are
unrecognized.
invalidParameterValue:
Input parameter names are recognized
but one or more passed value are invalid. For example, the file specified by
the fileUrl
does not exist.
uploadError:
Camera failed to upload.
Command I/O |
|
Command Input |
{ "parameters": { "fileUrl": "URL of the file.", "uploadUrl": "A string representing where to upload the file.", "accessToken": "A token containing the authentication information." } } |
Command Output |
none |
Command Output (Error) |
{ "error": { "code": "uploadError", "message": "Camera failed to upload the file." } } |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-09 UTC.
[null,null,["Last updated 2024-10-09 UTC."],[[["\u003cp\u003eThis command, available in API level 2.1 and later, allows apps to instruct the camera to directly upload images or videos to a server.\u003c/p\u003e\n"],["\u003cp\u003eThe camera uses provided parameters (\u003ccode\u003efileUrl\u003c/code\u003e, \u003ccode\u003euploadUrl\u003c/code\u003e, \u003ccode\u003eaccessToken\u003c/code\u003e) to form and send an HTTP POST request to the specified server.\u003c/p\u003e\n"],["\u003cp\u003eDirect Upload requires obtaining an access token and providing the file's URL and the server's upload URL within the command parameters.\u003c/p\u003e\n"],["\u003cp\u003eWhile the command itself returns no result, potential errors during the upload process can be indicated by specific error codes like \u003ccode\u003euploadError\u003c/code\u003e or \u003ccode\u003einvalidParameterValue\u003c/code\u003e.\u003c/p\u003e\n"]]],["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"],null,["# camera.uploadFile\n\nThe app issues this command to the camera to initiate upload of an image or\nvideo directly from the camera to a server. The camera should use the included\nparameters to form an HTTP POST request. The file to be uploaded is specified by\n`fileUrl` and it should be uploaded to `uploadUrl` with the correct\nauthorization specified by `accessToken`. **This command was added in API level\n2.1 and is relevant to\n[Direct Upload](/streetview/open-spherical-camera/guides/direct-upload)**\n\nOne could do this from a computer command line as: \n\n curl -X post -H \"Authorization: Bearer accessToken\" -T fileUrl uploadUrl\n\nParameters\n----------\n\n- `fileUrl:` The URL of the file to be uploaded to the server.\n- `uploadUrl:` A string representing where to upload the file.\n- `accessToken:` A token including the authentication information for the upload. It is obtained by the app and sent to the camera.\n\nResults\n-------\n\n- This command returns no result.\n\nErrors\n------\n\n- `missingParameter:` Some parameter, for example, `fileUrl` is missing.\n- `invalidParameterName:` One or more input parameter names are unrecognized.\n- `invalidParameterValue:` Input parameter names are recognized but one or more passed value are invalid. For example, the file specified by the `fileUrl` does not exist.\n- `uploadError:` Camera failed to upload.\n\n| Command I/O | |\n|----------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Command Input** | ```gdscript { \"parameters\": { \"fileUrl\": \"URL of the file.\", \"uploadUrl\": \"A string representing where to upload the file.\", \"accessToken\": \"A token containing the authentication information.\" } } ``` |\n| **Command Output** | ```text none ``` |\n| **Command Output (Error)** | ```gdscript { \"error\": { \"code\": \"uploadError\", \"message\": \"Camera failed to upload the file.\" } } ``` |"]]