SearchApiResponse Apex Class

In this article

Coveo for Salesforce 3.38 (August 2019)

This Apex Class represents a Coveo Search API search response.

The following attributes are available on a SearchApiResponse:

  • Map<String,Object> untyped: the raw response, untyped.

  • totalCount (integer): the total count of the number of results.

  • duration (integer): the query duration in ms.

  • searchUid (string): the UID to identify the query.

  • List<Object> rawResults: the results in raw format.

  • List<SearchApiResult> results: the list of the SearchApiResults (search results).

  • error (string): the error, if any.

  • statusCode (integer): the HTTP status code of the request.

String token = CoveoV2.Globals.generateSearchToken();
CoveoV2.SearchApiResponse response = CoveoV2.SearchApiClient.executeQuery(
    new Map<String,Object>{
        'q' => 'my query text'
    'Bearer ' + token);