Execute
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
/osc/commands/execute
API は、指定されたコマンドをカメラで実行します。 出力はコマンド オブジェクトです。
入力
名前 |
型 |
説明 |
name |
文字列 |
実行するコマンド。 |
parameters |
オブジェクト |
コマンド定義仕様に応じたコマンド入力パラメータ。 例については、OSC API 仕様をご覧ください。 |
出力
名前 |
型 |
説明 |
name |
文字列 |
実行するコマンド。 |
state |
文字列 |
コマンドの状態。 次のいずれかである必要があります。
done - 完了。このレスポンスで結果が返されています。
inProgress - まだ実行中です。
error - 失敗。レスポンスでエラーを確認してください。
|
id |
文字列(任意) |
コマンド ID。 この値は、ステータス inProgress を返すコマンドで必要です。 たとえば、camera.takePicture コマンドの実行には、スティッチングが必要なため、数秒間かかります。 詳細については、「ステータス」セクションをご覧ください。 |
results |
オブジェクト(任意) |
コマンドの結果。 この値は、コマンドが結果を返すことが予期される場合に、状態 done を返すコマンドで必要です。例: “results” : {
“AAA”:
“BBB”,
...
}
例については、OSC API 仕様をご覧ください。 |
error |
オブジェクト(任意) |
コマンドのエラーの説明。 この値は、状態 error; を返すコマンドで必要です。次に例を示します。
“error”: {
“code”: “missingParameter”
} |
progress |
オブジェクト(任意) |
コマンドの進行の説明。 この値は、状態 inProgress を返すコマンドで必要です。次に例を示します。
“progress”: {
“completion”: 0.8
} |
エラー
エラーコード |
説明 |
unknownCommand |
リクエストされたコマンドが不明です。 たとえば、v2 クライアント(clientVersion が 2 に設定されているクライアント。オプションをご覧ください)が API レベル 1 から廃止されたコマンドをリクエストすると、リクエストが失敗し、このエラーコードが表示されます。 |
disabledCommand |
実行されたコマンドは現在無効です。 たとえば、カメラがビデオモードの場合は `takePicture` が無効になり、カメラが delayProcessing をサポートしない場合は processPicture コマンドが無効になります。
このエラーコードは API レベル 2 で追加されました。 |
cameraInExclusiveUse |
カメラは既に排他的に使用されており、新しいセッションを開始できません。 このエラーコードは API レベル 2 で廃止されました。 |
missingParameter |
1 つ以上の必須パラメータが指定されていません。 |
invalidParameterName |
1 つ以上の入力パラメータまたはオプション名が認識できないか、サポートされていません。 |
invalidParameterValue |
パラメータまたはオプション名が認識されましたが、1 つ以上の値が無効です。たとえば、値が範囲外です。 |
例 |
リクエスト(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
}
}
} |
リクエスト(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
}
}
} |
レスポンス |
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"
} |
リクエスト(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"
}
} |
リクエスト(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"
} |
レスポンス |
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 2017-04-05 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"必要な情報がない"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"複雑すぎる / 手順が多すぎる"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"最新ではない"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻訳に関する問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"サンプル / コードに問題がある"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"その他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"わかりやすい"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"問題の解決に役立った"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"その他"
}]