APIのリモート設定 (Application Programming Interface) http://192.168.11.104/admin/remoteconfig
では、カメラのパラメータをリモートから直接変更するために使用される方法が説明されています。
カメラの HTTP インターフェースは、HTTP POSTリクエストのコマンドおよびパラメタの設定値を処理します:
POST /admin/remoteconfig HTTP/1.0 Content-type: application/x-www-form-urlencoded Authorization:Basic YWRtaW46bWVpbnNt Content-length:87 helo view section audio write params audio/MICRO=1 view section audio update store quit
パート |
説明 |
---|---|
POST /admin/remoteconfig HTTP/1.0 Content-type: application/x-www-form-urlencoded Authorization:Basic YWRtaW46bWVpbnNt Content-length:87 |
HTTP POSTリクエストのヘッダー。 |
|
空白行は内容とリクエストヘッダーを区別します。 |
helo
|
コマンドシーケンスの開始。 |
view section audio write params audio/MICRO=1 view section audio update store |
APIのリモート設定のコマンド セクションで記載された、特定のコマンドによるコマンドシーケンス |
終了
|
End of the command sequence. |
コマンドシーケンスを閉じるには最後にブランクとラインブレイクが必要です。
コンテントタイプ (Content-type: application/x-www-form-urlencoded
) は特定する必要はありませんが、カメラのウェブサーバが必要としています。
ウェブサーバで認証を処理します (この場合 基本
認証が必要です)。(":")とBase64でエンコードされたユーザー名とパスワードはコロンで連結されます。"admin:meinsm
" ユーザ名とパスワードはライン上を確認してください。
コンテントの長さ (Content-length
) は、ヘッダーの後に空白行が続く全データの長さです。
リクエストのコンテントは、各ラインごとに処理されます。
HTTP API ヘルプページの コマンド規定 セクションで説明があるように、パラメータの特殊文字は URL-エンコード する必要があります。
cURL
コマンドラインアプリケーションを使用した APIのリモート設定の出力 で詳細に説明があります。
以下の構文例で示されるコマンドが使用できます。
シンプルコマンド:
<command>
スペースで区切られたキーワードとコマンド:
<command> <keyword>
スペースで区切られたパラメータとコマンド:
<command> <parameter1> <parameter2>
スペースで区切られたコマンドキーワードおよび複数のパラメータ:
<command> <keyword> <parameter1> <parameter2>
コマンド |
説明 |
||||||||
---|---|---|---|---|---|---|---|---|---|
|
工場出荷時の値にカメラの設定や個別のセクション全体をリセットします。
|
||||||||
|
フラッシュストレージにコピーから設定をリストアします。
|
||||||||
|
全体の設定、特定のセクションまたは個々のパラメータを削除します。
|
||||||||
|
全てのセクションを書き込む、または、前に
|
||||||||
|
設定セクションにデータを追加します。セクションに追加するパラメータは、 SECTION <section name> Parameter=<value> Parameter=<value> ENDSECTION <section name> |
||||||||
|
設定全体または特定のセクションに戻ります (表示します)。
|
||||||||
|
設定値をフラッシュメモリへ永久保存します。 |
||||||||
|
カメラを再起動します。 |
||||||||
|
カメラを再起動せずに設定値の変更を適用します。
|
||||||||
|
現在の設定プロファイル名を持つ 1行を返信します。有効なプロファイルがない場合は、ラインは空欄にしてください。 |
||||||||
|
パラメータとして指定された設定プロファイルを有効にします: activate_profile <profile name> |
||||||||
|
適用される前に、再起動を必要とするすべての変更された設定セクションを返信します。変更に再起動が必要ない場合、このラインは空欄になります。 注記設定全体を変更した後 (ウェブインターフェースの設定からの |
||||||||
|
同じ意味です。どちらのコマンドも、上記のコマンドを終了し、APIコマンドシーケンスを閉じます。コマンドシーケンスでは 2つのどちらか 一方 のコマンドのみ使用することができます。 |
||||||||
|
利用できるコマンドのリストを返信します ( |
結果は、実行したコマンドによって返されたデータで構成されています。
情報の出力は "#
" で始まり、コマンドの処理中に進行状況を説明します。
エラーメッセージは "ERROR:
" で始まり発生したエラーの説明が続きます。
Commands without results data (reset
、 保存
など) には出力はありません。
エラーが発生すると、カメラは終了する前に "OK
" を返信してエラーに確認応答します。
この例では、HTTP要求を使用してマイクを有効化する方法を説明します。API のリモート設定を簡単にチェックするには、 cURL
Windowsにコマンドラインツール (http://curl.haxx.se/download.html) がダウンロードできます。Mac OS X およびほとんどの Linux PC には自動的にインストールされます。
このツールはカメラとの通信を操作するので、 cURL
を使用することで素早く、簡単にコマンドをチェックすることができます。例えば、 cURL
は自動的に正しいヘッダーを送信し、コマンドシーケンスの長さを計算します。
コマンド |
説明 |
---|---|
helo view section audio write params audio/MICRO=1 view section audio update store quit |
# Beginning of the command sequence. # Output the |
コマンドシェル (Windows) または ターミナル (Mac OS X, Linux) を開きます。
以下のコマンドラインを入力し、カメラの実データの <user name>
、 <password>
および <IP address>
を置き換えてください:
curl -q -v -u "<user name>:<password>" --data-binary @- "http://<IP address>/admin/remoteconfig"
[Enter] キーをクリックします; cURL
はコマンドを待機します。
最後のテーブル helo
から quit
の左列からテキストブロックをコピーします。
クリップボードのコンテンツをコマンドシェルまたはターミナルにコピーします。
[Ctrl+D] キーの組み合わせを 2回 (Windows, Linux) または 1回 (Mac OS X) 入力し、カメラへコマンドシーケンスを送信します。
<ユーザ名>:admin
<パスワード>: meinsm
<IP address>:10.8.0.118
* About to connect() to 10.8.0.118 port 80 (#0) * Trying 10.8.0.118... connected * Connected to 10.8.0.118 port 80 (#0) * Server auth using Basic with user 'admin' > POST /admin/remoteconfig HTTP/1.1 > Authorization:Basic YWRtaW46bWVpbnNt > User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.8 libssh2/0.18 > Host:10.8.0.118 > Accept:*/* > Content-Length:87 > Content-Type: application/x-www-form-urlencoded > * HTTP 1.0, assume close after body < HTTP/1.0 200 OK < Content-Type: text/plain; charset=utf-8 < Cache-Control: no-cache < #read:helo: #read:view section audio: #exec cmd=view section audio SECTION audio SPEAKER=1 MICRO=0 PREAMPLIFIER=2 SPEAKERLEVEL=0 ENDSECTION audio #read:write params: #exec cmd=write params #read:view section audio: #exec cmd=view section audio SECTION audio SPEAKER=1 MICRO=1 PREAMPLIFIER=2 SPEAKERLEVEL=0 ENDSECTION audio #read:update: #exec cmd=update #updating daemons! #read:store: #exec cmd=store #Storing to flash... #read:quit: OK #bye * Closing connection #0
"*
"、 "<
" または ">
" 文字で始まる出力は cURL
で生成されています。出力では、 ">
" はカメラに送信されたコマンドを優先し、 "<
" はカメラのウェブサーバから戻されるメッセージを優先します。残りのラインは APIのリモート設定のコマンドの出力 の説明通り API のリモート設定から戻されます。
help
を使用してコマンドリストを戻す
コマンド |
説明 |
---|---|
helo help quit |
# コマンドシーケンスの開始。 # 遠隔制御 APIのヘルプを呼び出す # コマンドシーケンスの終了。 |
コマンドシェル (Windows) または ターミナル (Mac OS X, Linux) を開きます。
以下のコマンドラインを入力し、カメラの実データの <user name>
、 <password>
および <IP address>
を置き換えてください:
curl -q -v -u "<user name>:<password>" --data-binary @- "http://<IP address>/admin/remoteconfig"
[Enter] キーをクリックします; cURL
はコマンドを待機します。
最後のテーブル helo
から quit
の左列からテキストブロックをコピーします。
クリップボードのコンテンツをコマンドシェルまたはターミナルにコピーします。
[Ctrl+D] キーの組み合わせを 2回入力し、カメラへコマンドシーケンスを送信します。
<user name>: admin
<パスワード>: meinsm
<IP address>:10.8.0.118
* About to connect() to 10.8.0.118 port 80 (#0) * Trying 10.8.0.118... connected * Connected to 10.8.0.118 port 80 (#0) * Server auth using Basic with user 'admin' > POST /admin/remoteconfig HTTP/1.1 > Authorization:Basic YWRtaW46bWVpbnNt > User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.8 libssh2/0.18 > Host:10.8.0.118 > Accept:*/* > Content-Length:87 > Content-Type: application/x-www-form-urlencoded > * HTTP 1.0, assume close after body < HTTP/1.0 200 OK < Content-Type: text/plain; charset=utf-8 < Cache-Control: no-cache < #read:helo: #read:help: The following commands are currently implemented: append reboot_needed view reboot write profile restore activate_profile reset update delete store exit quit help #read:quit: OK #bye * Closing connection #0
"*
"、 "<
" または ">
" 文字で始まる出力は cURL
で生成されています。出力では、 ">
" はカメラに送信されたコマンドを優先し、 "<
" はカメラのウェブサーバから戻されるメッセージを優先します。残りのラインは APIのリモート設定のコマンドの出力 の説明通り API のリモート設定から戻されます。
write
を使用してプロファイルラインを変更する
ipnotify
設定セクションのネットワークメッセージプロファイル ip0
のターゲットアドレス ipnotifyaddress
は、 10.0.0.42:8000
から 10.11.12.13:6750
に変更されます。
常にプロファイルライン全体を書き込む必要があります。プロファイルの個別の値は変更することができません。
コマンド |
説明 |
---|---|
helo view section ipnotify write params ipnotify/ip0/profile=ip0:_profilename=MxCC-Alarm :preset=mxpeg_alarm:ackn_time=60 :ipnotifyaddress=10.11.12.13%3A6750 :send=on_error:protocol=raw :boundary=--next-image--:httppath=:httpauth= :data=msg:ipnotifymessage=Hello World! :filetype=mxg:rate100=100:antetime=1 :posttime=1:systime=1440:ipnotifyport=0 view section ipnotify update store quit |
# Beginning of the command sequence. # Output the |
コマンドシェル (Windows) または ターミナル (Mac OS X, Linux) を開きます。
以下のコマンドラインを入力し、カメラの実データの <user name>
、 <password>
および <IP address>
を置き換えてください:
curl -q -v -u "<user name>:<password>" --data-binary @- "http://<IP address>/admin/remoteconfig"
[Enter] キーをクリックします; cURL
はコマンドを待機します。
最後のテーブル helo
から quit
の左列からテキストブロックをコピーします。
クリップボードのコンテンツをコマンドシェルまたはターミナルにコピーします。
[Ctrl+D] キーの組み合わせを 2回入力し、カメラへコマンドシーケンスを送信します。
<user name>: admin
<パスワード>: meinsm
<IP address>:10.8.0.118
* About to connect() to 10.8.0.118 port 80 (#0) * Trying 10.8.0.118... connected * Connected to 10.8.0.118 port 80 (#0) * Server auth using Basic with user 'admin' > POST /admin/remoteconfig HTTP/1.1 > Authorization:Basic YWRtaW46bWVpbnNt > User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g zlib/1.2.3.3 libidn/1.8 libssh2/0.18 > Host:10.8.0.118 > Accept:*/* > Content-Length:87 > Content-Type: application/x-www-form-urlencoded > * HTTP 1.0, assume close after body < HTTP/1.0 200 OK < Content-Type: text/plain; charset=utf-8 < Cache-Control: no-cache < #read:helo: #read:view section ipnotify: #exec cmd=view section ipnotify SECTION ipnotify ipnotify/ip0/profile=ip0:_profilename=MxCC-Alarm :preset=mxpeg_alarm:ackn_time=60 :ipnotifyaddress=10.0.0.42%3A8000 :send=on_error:protocol=raw :boundary=--next-image--:httppath=:httpauth= :data=msg:ipnotifymessage=Hello World! :filetype=mxg:rate100=100:antetime=1 :posttime=1:systime=1440:ipnotifyport=0 ... ENDSECTION ipnotify #read:write params: #exec cmd=write params #read:view section ipnotify: #exec cmd=view section ipnotify SECTION ipnotify ipnotify/ip0/profile=ip0:_profilename=MxCC-Alarm :preset=mxpeg_alarm:ackn_time=60 :ipnotifyaddress= 10.11.12.13%3A6750 :send=on_error:protocol=raw :boundary=--next-image--:httppath=:httpauth= :data=msg:ipnotifymessage=Hello World! :filetype=mxg:rate100=100:antetime=1 :posttime=1:systime=1440:ipnotifyport=0 ... ENDSECTION ipnotify #read:update: #exec cmd=update #updating daemons! #read:store: #exec cmd=store #Storing to flash... #read:quit: OK #bye * Closing connection 0
"*
"、 "<
" または ">
" 文字で始まる出力は cURL
で生成されています。出力では、 ">
" はカメラに送信されたコマンドを優先し、 "<
" はカメラのウェブサーバから戻されるメッセージを優先します。残りのラインは APIのリモート設定のコマンドの出力 の説明通り API のリモート設定から戻されます。
en, jp |