CMDB 메타 API

  • 릴리스 버전: Xanadu
  • 업데이트 날짜 2024년 08월 01일
  • 읽기9분
  • 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 옵션입니다. 액세스할 엔드포인트의 버전입니다. 예를 들면 v1 또는 v2입니다. 최신 버전이 아닌 엔드포인트 버전을 사용하려면 이 값만 지정합니다.

    데이터 유형: 문자열

    클래스 이름 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)

    요소 설명
    속성 지정된 클래스 테이블에서 사용 가능한 필드입니다.

    데이터 유형: 배열

    하위 지정된 클래스에서 확장된 클래스의 목록입니다.

    데이터 유형: 배열

    아이콘 클래스 아이콘 sys_id.

    데이터 유형: 문자열

    icon_url 클래스 아이콘 URL입니다.

    데이터 유형: 문자열

    identification_rules 지정된 클래스의 구성 항목 식별 규칙과 연결된 속성입니다.

    데이터 유형: 객체

    is_extendable 클래스를 확장하여 다른 클래스를 작성할 수 있는지 여부를 나타내는 플래그입니다.
    가능한 값:
    • true: 클래스를 확장할 수 있습니다.
    • false: 클래스를 확장할 수 없습니다.

    데이터 유형: 부울

    레이블 지정된 클래스 표시 이름입니다.

    데이터 유형: 문자열

    이름 테이블/클래스 이름입니다.

    데이터 유형: 문자열

    상위 상위 클래스입니다.

    데이터 유형: 문자열

    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
        }
      }
    }