Page tree
Skip to end of metadata
Go to start of metadata

Overview

The XML REST API lets a search client pose a query to the AIE server using HTTP.  AIE"s reply to the client (containing metadata, matching documents, and a copy of the query) is a page of XML that the client can parse in order to display the results.  The results include the query because the process is asynchronous and results of multiple queries might return to the client out of order. 

This page explains the XML syntax of most of the HTTP/REST response.  The XML that describes the query is presented on the XML REST Request page.

To view a typical REST response, pose any query from the AIE Administrator's Debug Search page.

The new-and-improved JSON REST API is easier to implement that the XML REST API.  Investigate that API first.

REST API Parameters

The master list of QueryRequest REST parameters is on the HTTP REST APIs page.

View incoming links.

 

Successful Response

<queryResponse time="0" workflowTime="0" totalRows="2">
  <history>
    <string>10.1.5.50:16000/spellCheckQuery.queryParser-1</string>
    ...
  </history>
  <feedback> 
    <queryFeedback name="spellcheck.suggested" stage="index-spellcheck.spellcheck">
      <message>spelling</message>
    </queryFeedback>
    <queryFeedback name="spellcheck.suggested.markedup" stage="index-spellcheck.spellcheck">
      <message>&lt;b&gt;spelling&lt;/b&gt;</message>
    </queryFeedback>
    ...
  </feedback>
  <documents time="0" numberFound="2" maxScore="222000" offset="0">
    <document score="222" routing="1,0" id="2">
      <fields>
        <field name="date" type="date">
          <value>
            <date>2010-04-21T14:29:27.000</date>
          </value>
        </field>
        <field name="title" type="string">
          <value>
            <string>2010-04-21T14:29:27.000</string>
          </value>
        </field>
        ...
      </fields>
    </document>
    ...
  </documents>
  <queryRequest>...</queryRequest>
</queryResponse>

queryResponse

The queryResponse element is the root element returned for a query response.

Attribute

Type

Description

time

long

The search time (in milliseconds)

workflowTime

long

The time spent during workflow processing (in milliseconds)

totalRows

long

Total number of matching rows

Child Element

Count

Description

history

1

Container for history messages

feedback

1

Container for feedback messages

documents

1

Container for response documents

queryRequest

1

The Transformed Query Request

history

The history element shows the history of workflow stages that processed the query.

Child Element

Count

Description

string

0 or more

Contains history message in CDATA

feedback

The feedback element provides any feedback information generated by workflow stages during query processing.

Child Element

Count

Description

queryFeedback

0 or more

Represents a feedback message

queryFeedback

The queryFeedback element contains a single feedback message generated by a workflow stage.

Attribute

Type

Description

name

string

the name of the feedback message

stage

string

the stage that generated the feedback message

Child Element

Count

Description

message

1

Contains string feedback message in CDATA

documents

The documents element contains all response documents.

Attribute

Type

Description

time

long

Document Retrieval time (in milliseconds)

numberFound

long

Total number of matching documents

maxScore

int

Score for highest score document

offset

long

The offset requested in the query request.

Child Element

Count

Description

document

0 or more

A document returned for a response

document

The document element contains all fields returned for a matching document.

Attribute

Type

Description

id

String

The Document's ID

Child Element

Count

Description

children

0 or 1

Container for a document's child documents

fields

1

Container for document's fields

children

The children element is just a container for the child documents for a root document (if any). Child documents may be attached to a root document when performing join queries for field collapsing.

Child Element

Count

Description

document

1 or more

A child document

fields

The fields element is just a container for the fields of a document.

Child Element

Count

Description

field

0 or more

The returned fields and their values.

field

The field element represents a returned field and its values.

Attribute

Type

Description

name

String

The name of the returned field

type

String

The data type for the returned field

Child Element

Count

Description

value

1 or more

A value for a field

value

The value element represents a value for a field.

Child Element

Count

Description

string

0 or 1

String value in CDATA

date

0 or 1

Date value in CDATA

int

0 or 1

Integer value in CDATA

long

0 or 1

Long value in CDATA

float

0 or 1

Float value in CDATA

double

0 or 1

Double value in CDATA

The value's child element may contain more complex types

queryRequest

This element represents the transformed query request that generated this response. This is advanced and full xml of this element will not be covered here.

Error Response

This is an example of an error response. The exact format may change in future versions of AIE.

<exceptionResponse clientId="" redelivered="false">
  <attivioException>
    <detailMessage>workflows parameter not specified</detailMessage>
    <errorCode category="CGI_API_PARSER" code="2"/>
    <stackTrace>
      <trace>com.attivio.messages.QueryRequest.create(QueryRequest.java:2253)</trace>   
      ...
    </stackTrace>
  </attivioException>
</exceptionResponse>

exceptionResponse

The exceptionResponse is the root element returned for failed queries.

Child Element

Count

Description

attivioException

1

Contains the details for the failure

attivioException

The attivioException element contains the details for an exceptionResponse.

Child Element

Count

Description

detailMessage

1

Contains error message in CDATA

errorCode

1

Contains the error code for the failure

stackTrace

1

Contains the stack trace for the exception

errorCode

The errorCode element contains a error code for an attivioException.

Attribute

Type

Description

category

String

The error category

code

int

The error code number

  • No labels