ACI API 24.1

# Manipulate a Response

The `Execute` method of an `IConnection` sends an action to an ACI server and returns a structure containing the response.

For an example of how to obtain this structure, see Obtain a Response to a Query.

## Obtain a Response to a Query

The following example shows how to run a command and retrieve the response.

    Response response = connection.Execute(query);

If the request is successful, `response.Data` provides access to an `XMLDocument` containing the response from the server. If the request failed, an exception is thrown from `connection.Execute`.

Consider the following example, which might be the result of the `Query` action performed in Create an Action:

    <autnresponse>
      <action>QUERY</action>
      <response>SUCCESS</response>
      <responsedata>
        <autn:numhits>2</autn:numhits>
        <autn:hit>
          <autn:reference>http://www.example.com/2</autn:reference>
          <autn:id>8</autn:id>
          <autn:section>0</autn:section>
          <autn:weight>96.00</autn:weight>
          <autn:database>Default</autn:database>
        </autn:hit>
        <autn:hit>
          <autn:reference>http://www.example.com/1</autn:reference>
          <autn:id>7</autn:id>
          <autn:section>0</autn:section>
          <autn:weight>96.00</autn:weight>
          <autn:database>Default</autn:database>
        </autn:hit>
      </responsedata>
    </autnresponse>

For an example of how to obtain a list of the references returned by the `Query` action, see Obtain Response Data From an XML Document.

## Obtain Response Data From an XML Document

The following example shows how to obtain a list of references returned by the `Query` action by selecting the reference of each hit in the ACI response

    XmlNamespaceManager namespaces =
        new XmlNamespaceManager(response.Data.NameTable);
    namespaces.AddNamespace(
        "autn", "http://schemas.autonomy.com/aci/");
    XmlNodeList nodes = response.Data.SelectNodes(
        "/autnresponse/responsedata/autn:hit/autn:reference",
        namespaces);
    foreach (XmlNode node in nodes)
    {
        Console.WriteLine(node.InnerText);
    }

Copyright 2023 Open Text
Version 24.1 | Last updated December 2023

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: IDOL ACI API 24.1

Topic Title: Manipulate a Response