CMDB メタ API

  • リリースバージョン: Xanadu
  • 更新日 2024年08月01日
  • 所要時間:10分
  • CMDB メタ API は、構成管理データベース (CMDB) クラスのメタデータを取得するためのエンドポイントを提供します。

    この API を使用するには、ユーザーに ITIL ロールが必要です。

    CMDB メタ - GET /now/cmdb/meta/{classname}

    指定された CMDB クラスのメタデータを返します。

    URL 形式

    バージョニングされた URL:/api/now/{api_version}/cmdb/meta/{className}

    デフォルトの URL:/api/now/cmdb/meta/{className}

    サポートされている要求パラメーター

    表 : 1. パスパラメーター
    名前 説明
    api_version オプションアクセスするエンドポイントのバージョン。たとえば、v1v2。最新以外のエンドポイントバージョンを使用する場合にのみ、この値を指定してください。

    データタイプ:文字列

    className CMDB クラス名。これは、cmdb_ci_linux_server や cmdb_ci_apache_web_server などの目的の CI レコードを含むテーブルの名前です。

    データタイプ:文字列

    表 : 2. クエリパラメーター
    名前 説明
    なし
    表 : 3. 要求本文パラメーター (XML または JSON)
    名前 説明
    なし

    ヘッダー

    次のリクエストや応答ヘッダーは、この HTTP アクションにのみ適用されるか、またはこのアクションに別個の方法で適用されます。REST API で使用される一般的なヘッダーのリストについては、「 サポートされている REST API ヘッダー」を参照してください。

    表 : 4. 要求ヘッダー
    ヘッダー 説明
    承認 応答本文のデータフォーマット。サポートされるタイプ:application/json または application/xml

    デフォルト: application/json

    表 : 5. 応答ヘッダー
    ヘッダー 説明
    なし

    ステータスコード

    この HTTP アクションには、次のステータスコードが適用されます。REST API で使用される可能性のあるステータスコードのリストについては、「 REST API HTTP 応答コード」を参照してください。

    表 : 6. ステータスコード
    ステータスコード 説明
    200 成功。要求が正常に処理されました。
    401 権限がありません。ユーザー資格情報が間違っているか、渡されていません。
    404 見つかりません。要求アイテムが見つかりませんでした。
    500 内部サーバーエラー。要求の処理中に予期しないエラーが発生しました。応答に、エラーに関する追加情報が含まれます。

    応答本文のパラメーター (JSON または XML)

    要素 説明
    attributes 指定されたクラステーブルの利用可能なフィールド。

    データタイプ:アレイ

    children 指定されたクラスから拡張されたクラスのリスト。

    データタイプ:アレイ

    icon クラスアイコンの sys_id。

    データタイプ:文字列

    icon_url クラスアイコンの URL。

    データタイプ:文字列

    identification_rules 指定されたクラスの構成アイテム識別ルールに関連付けられた属性。

    データタイプ:オブジェクト

    is_extendable クラスを拡張して他のクラスを作成できるかどうかを示すフラグ。
    可能な値:
    • true:クラスを拡張できます。
    • false:クラスを拡張できません。

    データタイプ:ブーリアン

    label 指定されたクラスの表示名。

    データタイプ:文字列

    name テーブル/クラス名。

    データタイプ:文字列

    parent 親クラス。

    データタイプ:文字列

    relationship_rules CMDB 内の指定されたクラスと他のクラスの間の関係。

    データタイプ:アレイ

    サンプル cURL 要求

    curl "https://instance.servicenow/api/now/cmdb/meta/cmdb_ci_computer" \
    --request GET \
    --header "Accept:application/json" \
    --user 'username':'password'
    
    {
      "result": {
        "icon_url": "images/app.ngbsm/computer.svg",
        "is_extendable": true,
        "parent": "cmdb_ci_hardware",
        "children": [
          "cmdb_ci_ucs_blade",
          "cmdb_ci_pc_hardware",
          "cmdb_ci_ucs_rack_unit",
          "cmdb_ci_mainframe_hardware",
          "cmdb_ci_server",
          "cmdb_ci_storage_switch"
        ],
        "name": "cmdb_ci_computer",
        "icon": "c6442dd69fb00200eb3919eb552e7012",
        "attributes": [
          {
            "is_inherited": "false",
            "is_mandatory": "false",
            "is_read_only": "false",
            "default_value": null,
            "label": "OS Address Width (bits)",
            "type": "integer",
            "element": "os_address_width",
            "max_length": "40",
            "is_display": "false"
          },
          {
            "is_inherited": "true",
            "is_mandatory": "false",
            "is_read_only": "true",
            "default_value": "false",
            "label": "Skip sync",
            "type": "boolean",
            "element": "skip_sync",
            "max_length": "40",
            "is_display": "false"
          },
          {
            "is_inherited": "true",
            "is_mandatory": "false",
            "is_read_only": "false",
            "default_value": null,
            "label": "DNS Domain",
            "type": "string",
            "element": "dns_domain",
            "max_length": "255",
            "is_display": "false"
          },
          {
            "is_inherited": "true",
            "is_mandatory": "false",
            "is_read_only": "false",
            "default_value": null,
            "label": "Purchased",
            "type": "glide_date",
            "element": "purchase_date",
            "max_length": "40",
            "is_display": "false"
          },
          {
            "is_inherited": "true",
            "is_mandatory": "false",
            "is_read_only": "false",
            "default_value": null,
            "label": "Lease contract",
            "type": "string",
            "element": "lease_id",
            "max_length": "40",
            "is_display": "false"
          }
        ],
        "relationship_rules": [
          {
            "parent": "cmdb_ci_computer",
            "relation_type": "cb5592603751200032ff8c00dfbe5d17",
            "child": "dscy_route_next_hop"
          },
          {
            "parent": "cmdb_ci_computer",
            "relation_type": "cb5592603751200032ff8c00dfbe5d17",
            "child": "dscy_router_interface"
          },
          {
            "parent": "cmdb_ci_computer",
            "relation_type": "cb5592603751200032ff8c00dfbe5d17",
            "child": "dscy_route_interface"
          },
          {
            "parent": "cmdb_ci_computer",
            "relation_type": "55c95bf6c0a8010e0118ec7056ebc54d",
            "child": "cmdb_ci_storage_pool"
          },
          {
            "parent": "cmdb_ci_computer",
            "relation_type": "55c95bf6c0a8010e0118ec7056ebc54d",
            "child": "cmdb_ci_disk_partition"
          },
          {
            "parent": "cmdb_ci_computer",
            "relation_type": "55c95bf6c0a8010e0118ec7056ebc54d",
            "child": "cmdb_ci_storage_volume"
          },
          {
            "parent": "cmdb_ci_computer",
            "relation_type": "55c95bf6c0a8010e0118ec7056ebc54d",
            "child": "cmdb_ci_storage_device"
          }
        ],
        "label": "Computer",
        "identification_rules": {
          "related_rules": [
            {
              "condition": "",
              "exact_count_match": false,
              "referenced_field": "installed_on",
              "active": true,
              "attributes": "name",
              "allow_fallback": false,
              "table": "cmdb_print_queue_instance",
              "order": 100,
              "allow_null_attribute": false
            }
          ],
          "applies_to": "cmdb_ci_hardware",
          "identifiers": [
            {
              "condition": "valid=true^absent=false^EQ",
              "exact_count_match": true,
              "referenced_field": "cmdb_ci",
              "active": true,
              "attributes": "serial_number,serial_number_type",
              "allow_fallback": false,
              "table": "cmdb_serial_number",
              "order": 100,
              "allow_null_attribute": false
            },
            {
              "condition": null,
              "exact_count_match": false,
              "referenced_field": null,
              "active": true,
              "attributes": "serial_number",
              "allow_fallback": false,
              "table": null,
              "order": 200,
              "allow_null_attribute": false
            },
            {
              "condition": null,
              "exact_count_match": false,
              "referenced_field": null,
              "active": true,
              "attributes": "name",
              "allow_fallback": false,
              "table": null,
              "order": 300,
              "allow_null_attribute": false
            },
            {
              "condition": "install_status!=100^EQ",
              "exact_count_match": true,
              "referenced_field": "cmdb_ci",
              "active": true,
              "attributes": "ip_address,mac_address",
              "allow_fallback": false,
              "table": "cmdb_ci_network_adapter",
              "order": 400,
              "allow_null_attribute": false
            }
          ],
          "name": "Hardware Rule",
          "description": "Identifier for hardware.",
          "active": true,
          "is_independent": true
        }
      }
    }