table of Contents
1. Create Custom Search Engine
2. Go to the API key website to get the api key
1. Create Custom Search Engine
To get the search engine ID, you must first create a Custom Search Engine.
We connect to the Custom Search Engine control panel to create the Search Engine.
https://cse.google.com/cse/all
Get Search Engine ID, copy the value
2. Go to the API key website to get the api key
https://developers.google.com/custom-search/v1/overview
Get API key
3. Test api key search
With the search engine ID & API key, we will be able to use the following URL to search for rich information on Google.
The URL must contain at least the following three parameters:
key: API key
cx: search engine ID
q: search text
Next, we can enter the information to be queried in the browser, and then we can put the query API in the App
Get search example:
Where INSERT_YOUR_API_KEY is replaced with your own api key
4. Search parameter list
Original link: https://developers.google.com/custom-search/v1/reference/rest/v1/cse/list
Parameters | |
---|---|
c2coff |
Enables or disables Simplified and Traditional Chinese Search. The default value for this parameter is 0 (zero), meaning that the feature is enabled. Supported values are:
|
cr |
Restricts search results to documents originating in a particular country. You may use Boolean operators in the cr parameter's value. Google Search determines the country of a document by analyzing:
See the Country Parameter Values page for a list of valid values for this parameter. |
cx |
The Programmable Search Engine ID to use for this request. |
dateRestrict |
Restricts results to URLs based on date. Supported values include:
|
exactTerms |
Identifies a phrase that all documents in the search results must contain. |
excludeTerms |
Identifies a word or phrase that should not appear in any documents in the search results. |
fileType |
Restricts results to files of a specified extension. A list of file types indexable by Google can be found in Search Console Help Center. |
filter |
Controls turning on or off the duplicate content filter.
Acceptable values are:
|
gl |
Geolocation of end user.
|
googlehost |
Deprecated. Use the The local Google domain (for example, google.com, google.de, or google.fr) to use to perform the search. |
highRange |
Specifies the ending value for a search range.
|
hl |
Sets the user interface language.
|
hq |
Appends the specified query terms to the query, as if they were combined with a logical AND operator. |
imgColorType |
Returns black and white, grayscale, transparent, or color images. Acceptable values are:
|
imgDominantColor |
Returns images of a specific dominant color. Acceptable values are:
|
imgSize |
Returns images of a specified size. Acceptable values are:
|
imgType |
Returns images of a type. Acceptable values are:
|
linkSite |
Specifies that all search results should contain a link to a particular URL. |
lowRange |
Specifies the starting value for a search range. Use |
lr |
Restricts the search to documents written in a particular language (e.g., Acceptable values are:
|
num |
Number of search results to return.
|
orTerms |
Provides additional search terms to check for in a document, where each document in the search results must contain at least one of the additional search terms. |
q |
Query |
relatedSite |
Specifies that all search results should be pages that are related to the specified URL. |
rights |
Filters based on licensing. Supported values include: |
safe |
Search safety level. Acceptable values are:
|
searchType |
Specifies the search type: Acceptable values are:
|
siteSearch |
Specifies a given site which should always be included or excluded from results (see |
siteSearchFilter |
Controls whether to include or exclude results from the site named in the Acceptable values are:
|
sort |
The sort expression to apply to the results. The sort parameter specifies that the results be sorted according to the specified expression i.e. sort by date. Example: sort=date. |
start |
The index of the first result to return. The default number of results per page is 10, so |