엔티티 검색

GET 오퍼레이션 요청을 Insight Server에 전송하여 솔루션 엔티티에 대한 정보를 검색할 수 있습니다. GET 요청에 대한 응답에는 엔티티 ID로 식별된 단일 엔티티 표현이 포함됩니다.

이 태스크 정보

기본적으로 검색된 정보는 XML 형식으로 리턴됩니다. 값을 JSON으로 설정하여 리턴되는 형식을 변경할 수 있습니다. 출력 형식 선택은 데이터 수신에 사용 중인 도구를 기반으로 합니다. JSON 출력의 읽기 및 해석 방법에 대한 자세한 정보는 JSON 맵핑을 참조하십시오.

프로시저

  1. 브라우저 주소 필드에 일반 REST URL을 입력하여 Insight Server에 액세스할 수 있는지 확인하십시오. REST URL의 예는 엔티티 관리를 참조하십시오.
  2. 브라우저 또는 스크립트를 사용하여 엔티티에 대한 정보를 검색하는 GET 요청을 전송하십시오. 예:
    https://localhost:9443/ibm/ia/rest/solutions/BankingSolution/entity-types/CustomerID/entities/200
    여기서 고객 엔티티의 ID는 200입니다.
    리턴된 컨텐츠는 다음과 같습니다.
    <object xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.ibm.com/ia/Entity" type="com.example.model.ComplexEntity">
      <attribute name="$CreationTime">
        <null/>
      </attribute>
      <attribute name="$IdAttrib">
        <string>id</string>
      </attribute>
      <attribute name="complexEvent">
        <object type="com.example.model.ComplexEvent">
          <attribute name="$Id">
            <string>25AAE2D8845270CAB511E5A3BE8C0B69</string>
          </attribute>
          <attribute name="$TimeAttrib">
            <string>datetime</string>
          </attribute>
          <attribute name="completed">
            <boolean>false</boolean>
          </attribute>
          <attribute name="complexEntities">
            <collection>
              <object type="com.ibm.ia.model.Relationship">
                <attribute name="key">
                  <string>E0025</string>
                </attribute>
                <attribute name="type">
                  <string>com.example.model.ComplexEntity</string>
                </attribute>
             
              </object>
              <object type="com.ibm.ia.model.Relationship">
                <attribute name="key">
                  <string>E0014</string>
                </attribute>
                <attribute name="type">
                  <string>com.example.model.ComplexEntity</string>
                </attribute>
             
              </object>
            </collection>
          </attribute>
          <attribute name="datetime">
            <null/>
          </attribute>
          <attribute name="value">
            <string>test</string>
          </attribute>
       
        </object>
      </attribute>
      <attribute name="enumType">
        <object type="com.example.model.EnumType" staticReference="gamma"/>
       
      </attribute>
      <attribute name="id">
        <string>E0025</string>
      </attribute>
      <attribute name="testConcepts">
        <collection>
          <object type="com.example.model.TestConcept">
            <attribute name="value">
              <int>3643</int>
            </attribute>
         
          </object>
          <object type="com.example.model.TestConcept">
            <attribute name="value">
              <int>-771</int>
            </attribute>
         
          </object>
        </collection>
      </attribute>
    
    </object>
    GET 요청에 선택사항으로 regex 매개변수를 포함할 수 있습니다. 표현식과 일치하는 엔티티, 엔티티 세트를 검색하려면 GET 요청에 정규식(regex) 조회 문자열을 추가하십시오. 조회에 엔티티 ID 또는 엔티티 ID의 범위가 포함되는 경우에는 일치하는 ID의 엔티티만 서버 응답에서 리턴됩니다. 예제:
    https://localhost:9443/ibm/ia/rest/solutions/BankingSolution/entity-types/CustomerID?regex=20[0-5]
    여기서 ID가 200, 201, 202, 203, 204 또는 205인 엔티티가 GET 요청에 대한 응답에서 리턴됩니다.
  3. 옵션: Accept 요청 헤더에서 값을 application/json으로 설정하여 JSON 형식의 엔티티에 대한 정보를 검색하십시오. 예:
    https://localhost:9443/ibm/ia/rest/solutions/BankingSolution/entity-types/CustomerID/entities/200
    여기서 고객 엔티티의 ID는 200입니다.
    리턴된 컨텐츠는 다음과 같습니다.
    {
      "$class": "com.example.model.ComplexEntity",
      "$CreationTime": null,
      "$IdAttrib": "id",
      "complexEvent": {
        "$Id": "25AAE2D8845270CAB511E5A3BE8C0B69",
        "$TimeAttrib": "datetime",
        "completed": false,
        "complexEntities": [
          {
            "$class": "com.ibm.ia.model.Relationship",
            "key": "E0025",
            "type": "com.example.model.ComplexEntity"
          },
          {
            "$class": "com.ibm.ia.model.Relationship",
            "key": "E0014",
            "type": "com.example.model.ComplexEntity"
          }
        ],
        "datetime": null,
        "value": "test"
      },
      "enumType": "gamma",
      "id": "E0025",
      "testConcepts": [
        {
          "value": 3643
        },
        {
          "value": -771
        }
      ]
    }
  4. 옵션: If-None-Match 요청 헤더 및 ETag 헤더를 포함하면 이전 요청 이후에 변경된 엔티티만 리턴할 수 있습니다.
    팁: 빈번하게 GET 요청을 실행하거나 GET 요청에 의해 많은 수의 엔티티가 리턴되는 경우에는 요청의 볼륨이 이벤트 처리 성능에 영향을 줄 수 있습니다. ETag 헤더를 사용하여 엔티티 검색을 최적화하고 처리 속도를 개선할 수 있습니다.