Update some Javascript uses to new Freebase API - part of #696
This commit is contained in:
parent
05968e37fa
commit
a06e16a9e5
@ -46,6 +46,7 @@ FreebaseLoadingDialog.prototype._createDialog = function() {
|
|||||||
var authorization = this._elmts.authorization;
|
var authorization = this._elmts.authorization;
|
||||||
var loadButton = this._elmts.loadButton;
|
var loadButton = this._elmts.loadButton;
|
||||||
|
|
||||||
|
// TODO: Does this need to be redone for the new API / freebase.com site?
|
||||||
var check_authorization = function(cont) {
|
var check_authorization = function(cont) {
|
||||||
var check_authorization_url = "command/freebase/check-authorization/" + provider;
|
var check_authorization_url = "command/freebase/check-authorization/" + provider;
|
||||||
$.get(check_authorization_url, function(data) {
|
$.get(check_authorization_url, function(data) {
|
||||||
|
@ -99,6 +99,8 @@ SchemaAlignment._batchSearch = function(queries, onDone) {
|
|||||||
batch[key] = queries[key];
|
batch[key] = queries[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: New API doesn't accept multiple queries
|
||||||
|
// args.push("https://www.googleapis.com/freebase/v1/search?key=" + Freebase.API_KEY + "&" +
|
||||||
args.push("http://api.freebase.com/api/service/search?" +
|
args.push("http://api.freebase.com/api/service/search?" +
|
||||||
$.param({ "queries" : JSON.stringify(batch) }) + "&callback=?");
|
$.param({ "queries" : JSON.stringify(batch) }) + "&callback=?");
|
||||||
|
|
||||||
|
@ -340,15 +340,13 @@ SchemaAlignmentDialog.UILink.prototype._configureTarget = function() {
|
|||||||
var dismissBusy = DialogSystem.showBusy();
|
var dismissBusy = DialogSystem.showBusy();
|
||||||
|
|
||||||
$.getJSON(
|
$.getJSON(
|
||||||
"http://api.freebase.com/api/service/mqlread?query=" + JSON.stringify({
|
"https://www.googleapis.com/freebase/v1/mqlread?key="+ Freebase.API_KEY + "&query=" + JSON.stringify({
|
||||||
query: {
|
|
||||||
"id" : this._link.property.id,
|
"id" : this._link.property.id,
|
||||||
"type" : "/type/property",
|
"type" : "/type/property",
|
||||||
"expected_type" : {
|
"expected_type" : {
|
||||||
"id" : null,
|
"id" : null,
|
||||||
"name" : null,
|
"name" : null,
|
||||||
"/freebase/type_hints/mediator" : null
|
"/freebase/type_hints/mediator" : null
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}) + "&callback=?",
|
}) + "&callback=?",
|
||||||
null,
|
null,
|
||||||
|
@ -33,12 +33,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
|
|
||||||
var Freebase = {};
|
var Freebase = {};
|
||||||
|
|
||||||
|
Freebase.API_KEY = "AIzaSyBAZ_EjMPKlOzyyZXv6JKXPPwJFISVji3M";
|
||||||
|
|
||||||
Freebase.mqlread = function(query, options, onDone) {
|
Freebase.mqlread = function(query, options, onDone) {
|
||||||
var params = {};
|
var params = {};
|
||||||
var queryEnv = {
|
// var queryEnv = {
|
||||||
"query": query
|
// "query": query
|
||||||
};
|
// };
|
||||||
|
|
||||||
|
// TODO: Options need to be handled differently for new API - but this doesn't appear to be used
|
||||||
if (options) {
|
if (options) {
|
||||||
for (var n in options) {
|
for (var n in options) {
|
||||||
if (options.hasOwnProperty(n)) {
|
if (options.hasOwnProperty(n)) {
|
||||||
@ -52,10 +55,10 @@ Freebase.mqlread = function(query, options, onDone) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
params.query = JSON.stringify(queryEnv);
|
params.query = JSON.stringify(query);
|
||||||
|
|
||||||
$.getJSON(
|
$.getJSON(
|
||||||
"http://api.freebase.com/api/service/mqlread?" + $.param(params) + "&callback=?",
|
"https://www.googleapis.com/freebase/v1/mqlread?key=" + Freebase.API_KEY + $.param(params) + "&callback=?",
|
||||||
null,
|
null,
|
||||||
onDone,
|
onDone,
|
||||||
"jsonp"
|
"jsonp"
|
||||||
|
@ -89,8 +89,8 @@ DataTableColumnHeaderUI.extendMenu(function(column, columnHeaderUI, menu) {
|
|||||||
"id" : data.id,
|
"id" : data.id,
|
||||||
"type" : []
|
"type" : []
|
||||||
};
|
};
|
||||||
var baseUrl = "http://api.freebase.com/api/service/mqlread";
|
var baseUrl = "https://www.googleapis.com/freebase/v1/mqlread?key=" + Freebase.API_KEY + "&";
|
||||||
var url = baseUrl + "?" + $.param({ query: JSON.stringify({ query: query }) }) + "&callback=?";
|
var url = baseUrl + $.param({ query: JSON.stringify(query) }) + "&callback=?";
|
||||||
|
|
||||||
$.getJSON(
|
$.getJSON(
|
||||||
url,
|
url,
|
||||||
|
Loading…
Reference in New Issue
Block a user