문제

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?

도움이 되었습니까?

해결책

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);
               });
        });
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top