- HTTP request
- Query parameters
- Request body
- Response body
- ClientContext
- UserContext
- SearchQuery
- SafeSearchLevel
- WebSearch
- SearchResult
- SearchInfo
Performs a full web search based on the provided request parameters.
HTTP request
GET https://websearchservice.googleapis.com/v1:search
The URL uses gRPC Transcoding syntax.
Query parameters
| Parameters | |
|---|---|
clientContext |
Required. Context surrounding the client. |
userContext |
Required. Context provided about the end user. |
searchQuery |
Required. Common query parameters for standard search operations. |
pageSize |
Optional. Number of search results to return (1-20). Default is 10. |
pageToken |
Optional. The next page token from the Web v1.search response. |
| One search mode must be populated. An empty proto can be a valid selection. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
webSearch |
Optional. Parameters specific to web search results. |
| End of mutually exclusive fields. | |
Request body
The request body must be empty.
Response body
Response to a WSS API search request.
If successful, the response body contains data with the following structure:
| JSON representation |
|---|
{ "searchResults": [ { object ( |
| Fields | |
|---|---|
searchResults[] |
The set of search results. |
searchInfo |
Metadata about this search, including timing, total results, and corrections. |
nextPageToken |
Token to retrieve the next page of results. Include this token in the subsequent SearchRequest.page_token field. Will be empty if there are no more results. |
ClientContext
Configuration for the v1.search Engine instance.
| JSON representation |
|---|
{ "clientId": string } |
| Fields | |
|---|---|
clientId |
Required. Client web property. The standard format is: partner-[name]-[product]-[feature set] Example: partner-example-wss-standard for an example using standard web search. |
UserContext
Context provided about the end user.
| JSON representation |
|---|
{ "ipAddress": string, "regionCode": string } |
| Fields | |
|---|---|
ipAddress |
Required. IP address of the end user. |
regionCode |
Optional. Region code of end user. Only two letter country codes (ISO 3166) are valid. |
SearchQuery
Common query parameters for standard search operations.
| JSON representation |
|---|
{
"query": string,
"languageCode": string,
"restrictLanguageCode": string,
"restrictRegionCode": string,
"safeSearch": enum ( |
| Fields | |
|---|---|
query |
Required. The search query string. Many search features can be represented directly in the query string using Google v1.search operators (see https://support.google.com/websearch/answer/2466433): |
languageCode |
Optional. --- Language & Region --- Sets the user interface language. See https://developers.google.com/web-search-service/xml/web-search/reference/appendixes.html#supported_interface_languages for a list of supported languages. |
restrictLanguageCode |
Optional. Restricts search to documents written in a particular language. See https://developers.google.com/web-search-service/xml/web-search/reference/appendixes.html#language_collection_values for a list of supported languages. |
restrictRegionCode |
Optional. Restricts search results to documents originating in a particular country. Only two letter country codes (ISO 3166) are valid. See https://developers.google.com/web-search-service/xml/web-search/reference/appendixes.html#supported_country_codes for a list of supported countries. |
safeSearch |
Optional. The search safety level. |
sortExpression |
Optional. --- Sorting & Range --- The sort expression to apply to the results (e.g., sort=date). |
| Restricts results to URLs based on date. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
days |
Optional. Requests results from the specified number of past days. |
weeks |
Optional. Requests results from the specified number of past weeks. |
months |
Optional. Requests results from the specified number of past months. |
years |
Optional. Requests results from the specified number of past years. |
| End of mutually exclusive fields. | |
SafeSearchLevel
--- Safety & Filters ---
| Enums | |
|---|---|
SAFE_SEARCH_LEVEL_UNSPECIFIED |
The safe search level is not specified. |
OFF |
Turns off SafeSearch. |
ON |
Turns on SafeSearch. |
WebSearch
This type has no fields.
Parameters specific to web page search.
SearchResult
Represents a single search result item.
| JSON representation |
|---|
{ "title": string, "htmlTitle": string, "displayUrl": string, "shortenedDisplayUrl": string, "snippet": string, "htmlSnippet": string, "mimeType": string, "fileFormat": string } |
| Fields | |
|---|---|
title |
The title of the search result, in plain text. |
htmlTitle |
The title of the search result, in HTML. |
displayUrl |
The full URL to which the search result is pointing, e.g. http://www.example.com/foo/bar. |
shortenedDisplayUrl |
A shortened version of this search result's URL, e.g. www.example.com. |
snippet |
The snippet of the search result, in plain text. |
htmlSnippet |
The snippet of the search result, in HTML. |
mimeType |
The MIME type of the search result. |
fileFormat |
The file format of the search result. |
SearchInfo
Metadata about the search operation.
| JSON representation |
|---|
{ "searchDuration": string, "totalResults": string, "formattedTotalResults": string, "correctedQuery": string, "htmlCorrectedQuery": string } |
| Fields | |
|---|---|
searchDuration |
The time taken for the server to return search results. A duration in seconds with up to nine fractional digits, ending with ' |
totalResults |
The estimated total number of search results available for the query. |
formattedTotalResults |
The estimated total number of search results, formatted according to locale style. |
correctedQuery |
The correctly spelled query. |
htmlCorrectedQuery |
The correctly spelled query, formatted in HTML. |