Execute
Stay organized with collections
Save and categorize content based on your preferences.
The /osc/commands/execute
API executes specified commands on the camera. The output is a command object.
Name |
Type |
Description |
name |
String |
The command to be executed. |
parameters |
Object |
Command input parameters according to the command definitions specification. Please refer to OSC API Specification for examples. |
Output
Name |
Type |
Description |
name |
String |
The command to be executed. |
state |
String |
State of the command. Should be one of the following:
done - Complete, results have been returned in this response.
inProgress - Execution is still in progress.
error - Failed, see error in the response.
|
id |
String (optional) |
Command ID. This value is required for commands returning the status inProgress. For example, the camera.takePicture command takes a few seconds due to the need for stitching. See the “Status” section for more details. |
results |
Object (optional) |
Command results. This value is required for commands returning state done if the command is expected to return results; for example,
“results” : {
“AAA”: “BBB”,
...
}
Please refer to OSC API Specification for examples. |
error |
Object (optional) |
Command error description. This value is required for commands returning state error; for example,
“error”: {
“code”: “missingParameter”
} |
progress |
Object (optional) |
Command progress description. This value is required for commands returning state inProgress ; for example,
“progress”: {
“completion”: 0.8
} |
Error
Error code |
Description |
unknownCommand |
Requested command is unknown, e.g. if a v2 client (clientVersion is set to 2, see Options) requests a deprecated command from API level 1, the request should fail with this error code. |
disabledCommand |
Command executed is currently disabled, e.g. `takePicture` command is disabled when
camera is video mode, processPicture command is disabled when the camera doesn’t support delayProcessing. This error code was added in API level 2. |
cameraInExclusiveUse |
Camera is already in exclusive use, new session can’t be started. This error code was deprecated in API level 2. |
missingParameter |
One or more required parameters were not specified. |
invalidParameterName |
One or more input parameter or option name was unrecognized or unsupported. |
invalidParameterValue |
The parameter or option names were recognized, but one or more values is invalid; for example, the value is out of range. |
Example |
Request (API 1) |
POST /osc/commands/execute HTTP/1.1
Host: [camera ip address]:[httpPort]
Content-Type: application/json;charset=utf-8
Accept: application/json
Content-Length: {CONTENT_LENGTH}
X-XSRF-Protected: 1
{
"name": "camera.setOptions",
"parameters": {
"sessionId": "12ABC3",
"options": {
"iso": 200,
"exposureCompensation": -2
}
}
} |
Request (API 2) |
POST /osc/commands/execute HTTP/1.1
Host: [camera ip address]:[httpPort]
Content-Type: application/json;charset=utf-8
Accept: application/json
Content-Length: {CONTENT_LENGTH}
X-XSRF-Protected: 1
{
"name": "camera.setOptions",
"parameters": {
"options": {
"iso": 200,
"exposureCompensation": -2
}
}
} |
Response |
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Content-Length: {CONTENT_LENGTH}
X-Content-Type-Options: nosniff
{
"name": "camera.setOptions",
"state": "done"
} |
Request (API 1) |
POST /osc/commands/execute HTTP/1.1
Host: [camera ip address]:[httpPort]
Content-Type: application/json;charset=utf-8
Accept: application/json
Content-Length: {CONTENT_LENGTH}
X-XSRF-Protected: 1
{
"name": "camera.takePicture",
"parameters": {
"sessionId": "12ABC3"
}
} |
Request (API 2) |
POST /osc/commands/execute HTTP/1.1
Host: [camera ip address]:[httpPort]
Content-Type: application/json;charset=utf-8
Accept: application/json
Content-Length: {CONTENT_LENGTH}
X-XSRF-Protected: 1
{
"name": "camera.takePicture"
} |
Response |
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
Content-Length: {CONTENT_LENGTH}
X-Content-Type-Options: nosniff
{
"name": "camera.takePicture",
"state": "inProgress",
"id": "90ABCD",
"progress": {
"completion": 0
}
} |
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-09 UTC."],[],[]]