This is a translation of the original English documentation page. Help us make it better.

script.update

説明

object script.update(object/array scripts)

このメソッドでは、既存のスクリプトを更新できます。

このメソッドはSuper adminユーザータイプでのみ使用できます。 メソッドを呼び出す権限は、ユーザーロール設定で取り消すことができます。 詳細についてはユーザーの役割を参照してください。

パラメータ

(object/array) スクリプトのプロパティが更新されます。

scriptidプロパティはスクリプトごとに定義する必要があり、すべてのプロパティはオプションです。 渡されたプロパティのみが更新され、他のプロパティは変更されません。 例外はtypeプロパティが5(Webhook)からその他に変更された場合です。その場合はparametersプロパティはクリーンアップされます。

戻り値

(object) scriptidsプロパティの下で更新されたスクリプトのIDを含むオブジェクトを返します。

スクリプトコマンドの変更

スクリプトのコマンドを"/bin/ping -c 10 {HOST.CONN} 2>&1"に変更します。

Request:

{  "jsonrpc": "2.0",  "method": "script.update",  "params": {  "scriptid": "1",  "command": "/bin/ping -c 10 {HOST.CONN} 2>&1"  },  "auth": "038e1d7b1735c6a5436ee9eae095879e",  "id": 1 }

Response:

{  "jsonrpc": "2.0",  "result": {  "scriptids": [  "1"  ]  },  "id": 1 }

スクリプトコマンドを変更して、手動入力を追加します

スクリプトのコマンドを "/bin/ping -c {MANUALINPUT} {HOST.CONN} 2>&1" に変更します。

リクエスト:

{  "jsonrpc": "2.0",  "method": "script.update",  "params": {  "scriptid": "1",  "command": "/bin/ping -c {MANUALINPUT} {HOST.CONN} 2>&1",  "manualinput": "1",  "manualinput_prompt": "Specify the number of ICMP packets to send with the ping command",  "manualinput_validator": "^(?:[1-9]|10)$",  "manualinput_validator_type": "0",  "manualinput_default_value": "10"  },  "id": 1 }

Response:

{  "jsonrpc": "2.0",  "result": {  "scriptids": [  "1"  ]  },  "id": 1 }

ソース

CScript::update() in ui/include/classes/api/services/CScript.php.