NX-APIとmodel-driven操作の選択2 / 4

XML形式とREST object

同じNX-API CLIのshow要求をXMLで表す場合、ins_apiのtype/input/output_format等を対応させる。

<ins_api>
  <version>1.0</version><type>cli_show</type><chunk>0</chunk><sid>1</sid>
  <input>show interface brief</input><output_format>xml</output_format>
</ins_api>

CLIを要求する/insと、NX-API RESTで/api/mo/sys.json等のmanaged objectを操作する形を区別する。RESTではtopSystem等のclass、attributes/childrenとDNをschemaへ合わせる。

{"topSystem":{"attributes":{"name":"LEAF-A"}}}

これはsys objectのsystem nameを表す部分payloadである。GETでの取得、POST等の変更、対象DNと必要なroleを区別する。HTTP成功とMO/CLI結果、startupへの保存と再取得の確認を別に扱う。

学習パスへ
参考資料