GoogleAPICustomSearch.search()

Executes the search using Customsearch API call

Usage

Hover over inputs/exits for more info.

var GoogleAPICustomSearch = require('machinepack-googleapicustomsearch');


// Executes the search using Customsearch API call

GoogleAPICustomSearch.search({

q: 'test search',

cx: '',

cref: '',

auth: 'AIzaSyAYVDlaoVs_GZw9JNvSclRWH_PEMKII6tc',

alt: 'atom',

c2coff: '',

cr: '',

fileType: 'jpg',

searchType: 'image',

sort: '',

start: 15,

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// Invalid field parameter passed

invalidParameter: function () {

 

},

// Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.

dailyLimitExceededUnreg: function () {

 

},

// OK.

success: function () {

 

},

});

Inputs

q required

Search phrase

'test search'
cx

The custom search engine ID to use for this request

''
cref

The URL of a linked custom search engine specification to use for this request.

''
auth

You generated API_KEY

'AIzaSyAYVDlaoVs_GZw9JNvSclRWH_PEMKII6tc'
alt

JSON/Atom Custom Search API can return results in one of two formats. JSON is the default data format; you can get results in Atom format by specifying the alt=atom query parameter

'atom'
c2coff

Turns off the translation between zh-CN and zh-TW.

''
cr

Country restrict(s)

''
fileType

Returns images of a specified type. Some of the allowed values are: bmp, gif, png, jpg, svg, pdf, ...

'jpg'
searchType

Specifies the search type

'image'
sort

The sort expression to apply to the results

''
start

The index of the first result to return

15

Exits

error

An unexpected error occurred.

invalidParameter

Invalid field parameter passed

dailyLimitExceededUnreg

Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.

success

OK.