tech note

インフラ技術や車についてつぶやいていくブログ

RackTablesで使えるRestAPIを紹介【日本語情報はここだけ】

f:id:tea_cat:20180816105003j:plain
おそらく日本語情報はここだけ

オブジェクト一覧をJSON形式で表示

/api.php?method=get_depot

オブジェクト情報を表示

/api.php?method=get_object&object_id=12345

object_id

対象オブジェクトID

オブジェクトを追加

/api.php?method=add_object&object_name=${host}&object_type_id=4&object_label=${rack}

object_name

Common name

object_type_id

object_type_id ObjectType
4 Server
8 Network switch
798 Network security

(代表例)

object_label

Visible label

オブジェクトIDを確認

/api.php?method=get_depot

RackIDを確認

/api.php?method=get_rackspace

Rackに追加

/api.php?method=update_object_allocation&object_id=${object_id}&allocate_to\[\]=atom_${rack_id}_${unit}_0&allocate_to\[\]=atom_${rack_id}_${unit}_1&allocate_to\[\]=atom_${rack_id}_${unit}_2

object_id

オブジェクトID

allocate_to

Rack位置

atom_${rack_id} _${unit} _0
RackID Unit番号 前0中1後2

IPアドレス追加

/api.php?method=add_object_ip_allocation&object_id=${object_id}&ip=${ip_addr}

object_id

オブジェクトID

ip_addr

IPアドレス

sharedで入れたい場合
/api.php?method=add_object_ip_allocation&object_id=${object_id}&ip=${ip_addr}&bond_type=shared

オブジェクト削除

/api.php?method=delete_object&object_id=${delete_object_id}

object_id

削除対象オブジェクトID

オブジェクト情報更新

/api.php?method=edit_object&object_name=${host}&object_id=${id}&object_comment=COMMENT&object_label=${label}&object_asset_no=&object_type_id=4&object_has_problems=on"

object_name

Common name

object_id

オブジェクトID

object_comment

Comment

object_label

Visible label

object_asset_no

Asset tag

object_type_id

object_type_id ObjectType
4 Server
8 Network switch
798 Network security

(代表例)

object_has_problems

on Has problemsチェック有り
no Has problemsチェック無し

IPv4アドレス一覧を表示

/api.php?method=get_ipv4network&network_id=${net_id}

network_id

ipv4netのid