Use the Search request to the Search API operation to perform a simple query:
In the request query string:
If the access token you are using to authenticate the call does not implicitly specify the organization it refers to (i.e., if it is not a search token):
<MyOrganizationId>by the actual ID of the target Coveo Cloud V2 organization (see Getting the organizationId).
organizationIdparameter at al in your request query string.
Authorization HTTP header:
In the request body:
<MyQuery>by the basic query expression you want to forward to the Search API, such as the keywords an end-user would enter in a search box.
The body of a successful response (
200 OK) contains information about the query itself, such as its
duration and the
totalCount of query result items. Most importantly, the response body contains the query
By default, elements in the
results array are sorted by relevancy: a standard set of ranking rules is applied to compute a
score value for each query result item; the higher a query result item
score value is, the lower its 0-based index position in the
results array will be. There are several ways you can impact the
score value of query result items. Of course, the Search API also allows you to use other sort criteria than the
score value, so you should never have to sort query result items client-side.
Each element in the
results array contains specific information about a single query result item: its
clickUri, automatically generated
excerpt, etc. You can leverage those values to display relevant information when rendering the query results in a graphical search interface. You can also take advantage of the
excerptHighlights properties to adequately emphasize basic query expression keywords in the title and excerpt.
raw property of each
results element is also very important, as it holds the fields which were retrieved for this item, and their corresponding values. Each field typically contains specific metadata about an item: its most recent modification
size, the name of its
sourceType, etc. You can explicitly specify which fields to include in (or exclude from) the query result items when performing a query.