ExecuteQuery

Article:HOWTO76895  |  Created: 2012-05-07  |  Updated: 2012-05-08  |  Article URL http://www.symantec.com/docs/HOWTO76895
Article Type
How To


Subject


Name

ExecuteQuery — Runs query for the given input query information.

Syntax

.NET syntax:

QueryRun ExecuteQuery(Query query);

Service URLs

Use the following URLs to access the IQueriesService:

  • http://<localhost>/CCS/Services/Applications/Queries/IQueriesService/WS/WindowsSecurity

  • https://<localhost>:<portnumber>/CCS/Services/Applications/Queries/IQueriesService/WS/WindowsSecurity

  • https://<localhost>:<portnumber>/CCS/Services/Applications/Queries/IQueriesService/WS/UsernameSecurity

  • https://<localhost>:<portnumber>/CCS/Services/Applications/Queries/IQueriesService/Basic/UsernameSecurity

Authorization Requirements

You must have the following CCS tasks to use the API:

  • View Queries

  • Manage Queries

  • Manage Jobs

  • View All Jobs

  • Execute Queries

You must have the permissions on the following folder to use the API:

  • Queries folder

Input parameters

The ExecuteQuery API requires the Query data contract as an input.

The following table describes the fields in the Query data contract that the API requires:

Table: IQueriesService- ExecuteQuery- input parameters

Field name

Field type

Data type

Description

name

Optional

String

The query name used for search.

QueryID

Mandatory

Guid

The unique identifier of query.

platform

Optional

String

The platform of query.

dataSource

Optional

String

The data source of query.

containerPath

Optional

String

The path of the container used for search.

searchSubtree

Optional

Boolean

The search criteria which is either current level or subtree.

Return value

The API returns a QueryRun object which contain following query attributes:

Table: QueryRun Object

Field name

Data type

Description

StartDate

DateTime

The date when the query started.

EndDate

DateTime

The date when the query completed.

RunDuration

String

The duration of query run.

RunStatus

String

The status of query run.

ResultReceived

long

The number of records received.

ErrorCount

long

The number of errors received.

RunID

Guid

The unique identifier of query run.

SOAP faults

All the error results are returned to the calling application as SOAP faults:

Table: IQueriesService - ExecuteQuery - SOAP faults

Event

Description

InvalidArgumentError

You may be overriding the limitations of certain input parameters.

Sample: C#

// Exceute Query
            QueriesServiceClient client = new QueriesServiceClient();
            client.ClientCredentials.UserName.UserName = "e2edom\\administrator";
            client.ClientCredentials.UserName.Password = "password@123";
            System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);

            try
            {
                // Search for sepcific query.
                string queryName = "Query1";
                string platform = "Windows";
                Query[] queries = client.SearchQuery(queryName, platform, null, null, true);
                // Execute query.
                QueryRun queryRun = client.ExecuteQuery(queries[0]);
            }
            catch (Exception exp)
            {
                Console.WriteLine(exp.Message);
            }

Sample: Java client

try
        {
            // Call Web Service Operation
            QueriesService service = new QueriesService();
            IQueriesService port = service.getBasicHttpBindingIQueriesService();
            // TODO initialize WS operation arguments here
            ArrayOfQuery result = port.searchQuery("Files", null,null, null, true);
            //List<Query> queries = result.getQuery();
            Query query = result.getQuery().get(0);
            //Query query = new Query();
            //query.setQueryID("96bac2a8-b155-4f0a-84e4-1defeaeee13f");

            // TODO process result here
            QueryRun result1 = port.executeQuery(query);
            System.out.println("Result = "+result);
        }
        catch (Exception exception)
        {
            System.out.println(exception.getMessage());
        }

Related links

See About IQueriesService.


Legacy ID



v71889672_v74603629


Article URL http://www.symantec.com/docs/HOWTO76895


Terms of use for this information are found in Legal Notices