function callATS()

in javascript/topsites.js [17:32]


function callATS(apikey, country) {
  var uri = '/api?Action=TopSites&Count=5&CountryCode=' + country + '&ResponseGroup=Country&Output=json';

  var opts = {
    host: apiHost,
    path: uri,
    uri: 'https://' + apiHost + uri,
    json: true,
    headers: {'x-api-key': apikey},
        resolveWithFullResponse: true
  }

  rp(opts)
  .then( (html)=> console.log(`${JSON.stringify(html.body, null, 2)}`) )
  .catch( (e)=> console.log('failed:'+e))
}