An Arrow connector that connects to google custom search REST API. The Connector provides a single API endpoint which you can query.
You can use
npm install appc.googlesearch
or add
"appc.googlesearch" : "1.0.0"
to you packacge.json file.
Register the connector in your appc.json file :
"dependencies": {
...
"connector/appc.googlesearch": "^0.0.5"
},
...
Set the configuration object in your conf/default.js
file :
connectors: {
'appc.googlesearch': {
key: '<googleCustomSearchKey>',
//One of the following two should be set
cx: '<googleCustomSeachCX>', //provide this
cref: '<googleCustomSearchCREF>' //or this
}
}
Take a look at all available options and query parameters, in the API documentation section of your arrow administration. Options are available under the group Google Search.
The connector returns a result object that slightly differs from the default API endpoint output. The connector adds "context"
Object, as a first level object in the returned result:
{
'success': true,
'request-id': '<requId>',
'key': 'customsearches',
'customsearches': [],
'context': {}
};
Where "context" has the following structure:
{
title : String,
facets : Array,
totalResults : Number
restUrl : String
}
Where
- title - is the Custom Search title (set by Google)
- facets - an Array holding all the facets, registered for this search
- totalResults - the number of items in this set
- restUrl - the actual REST url (to google search)
To test the connector, just run
npm test
Be sure to set and parameters in /conf/default.js before runing tests