[Vuejs]-Google Knowledge Graph searching with ids

2👍

The solution that worked for me was using the part after the ‘:’ as the actual id.
That let to the following solution that supports more than on id:

    let service_url = 'https://kgsearch.googleapis.com/v1/entities:search';
    let dataurl = 'key={API-KEY}'; //just the key, not the moustaches '{','}'
    for (let i = 0; i < allIds.length; i++) {
        dataurl += '&ids='+ allIds[i].split(':')[1];
    }
    $.getJSON(service_url + '?callback=?', dataurl, (response) => {
    }).done((response) => {});
👤telion

Leave a comment