Consumig Azure/Bing API using meteor


#1

Hi All,

I am using meteor HTTP.call method in following way to call Azure/Bing Search API using GET call

var method = ‘GET’;
var url = ‘https://api.datamarket.azure.com/Bing/Search/Web/’;
var options = {
headers: {‘Content-Type’: ‘application/json’},
‘auth’:":Ms2cSpSocvUjxOmQ73oHjVZTFj1Xfwxg9Ko8PPimzuo",
query:“something”
}

HTTP.call(method, url, options, function(error, result) {
if (error) {
console.log(‘ERRR’);
console.log(error);
} else
console.log(‘RESULT’);
console.log(result);
});

Could anyone suggest whats wrong with this code ?


#2

When I try this in postman I get 401 The authorization type you provided is not supported. Only Basic and OAuth are supported - that may be because I’m not authenticated and you are.

However, the syntax you’ve provided is a little off. The call should look like:

HTTP.call(method, url, options, function(error, result) {
  if (error) {
    console.log('ERRR');
    console.log(error);
  } else {
    console.log('RESULT');
    console.log(result);
  }
});

Also, does the auth value really begin with a :?