Search code examples
javascriptfreebasegoogle-client

gapi.client.freebase.mqlread returns empty result


I'm trying to use the freebase javascript api. The following doesn't return any results ...

  var query = [{'type':'/people/person','id':null,'name':null}];
  gapi.client.setApiKey('API-KEY');
  gapi.client.load('freebase', 'v1', function(){
          var request = gapi.client.freebase.mqlread({'query': JSON.stringify(query)});
          request.execute(function(response) {
            console.log(response.result);
         });
  });

I know the query is good because I tested that out with the mql editor. The api key is good because I use that with gapi.client.request. Are the gapi.client.freebase calls currently functional?


Solution

  • I figured it out. The Javascript interface is a little different from the Java interface. The response is the result. This worked ...

            var query = [{'type':'/people/person','id':null,'name':null}];
            gapi.client.load('freebase', 'v1', function(){
                    var request = gapi.client.freebase.mqlread({'query': JSON.stringify(query)});
                    request.execute(function(response) {
                      console.log(response);
                   });
            });