The /osc/commands/execute API executes specified commands on the camera. The output is a command object.
Input
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 statusinProgress. 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 statedone 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/executeHTTP/1.1Host:[camera ip address]:[httpPort]Content-Type:application/json;charset=utf-8Accept:application/jsonContent-Length:{CONTENT_LENGTH}X-XSRF-Protected:1{"name":"camera.setOptions","parameters":{"sessionId":"12ABC3","options":{"iso":200,"exposureCompensation":-2}}}
Request (API 2)
POST/osc/commands/executeHTTP/1.1Host:[camera ip address]:[httpPort]Content-Type:application/json;charset=utf-8Accept:application/jsonContent-Length:{CONTENT_LENGTH}X-XSRF-Protected:1{"name":"camera.setOptions","parameters":{"options":{"iso":200,"exposureCompensation":-2}}}
POST/osc/commands/executeHTTP/1.1Host:[camera ip address]:[httpPort]Content-Type:application/json;charset=utf-8Accept:application/jsonContent-Length:{CONTENT_LENGTH}X-XSRF-Protected:1{"name":"camera.takePicture","parameters":{"sessionId":"12ABC3"}}
Request (API 2)
POST/osc/commands/executeHTTP/1.1Host:[camera ip address]:[httpPort]Content-Type:application/json;charset=utf-8Accept:application/jsonContent-Length:{CONTENT_LENGTH}X-XSRF-Protected:1{"name":"camera.takePicture"}
[null,null,["Last updated 2024-10-09 UTC."],[[["The `/osc/commands/execute` API allows you to execute commands on the camera, such as adjusting settings or taking pictures."],["Input requires the command `name` and any necessary `parameters` defined in the OSC API Specification."],["Output provides the command `name`, `state`, and may include an `id`, `results`, `error`, or `progress` depending on the command and its execution status."],["Possible command states include `done`, `inProgress`, and `error`, with further details provided in the output fields."],["Refer to the OSC API Specification for specific command definitions, parameters, and result formats."]]],["The `/osc/commands/execute` API triggers commands on a camera, defined by a command `name` and associated `parameters`. The output indicates the command's `state` (`done`, `inProgress`, or `error`), an optional `id` for `inProgress` commands, `results` for completed commands, or `error` details. Possible errors include `unknownCommand`, `disabledCommand`, `missingParameter`, and `invalidParameterValue`. Example requests demonstrate how to set options and take a picture, with the responses showing command completion or ongoing progress.\n"]]