1

I was playing around with the Knowledge Graph API recently, but can't really get it to return anything useful.

My scenario is this: I query the API for maxim gorki theater, and it rightly returns the entry for the theater in Berlin. Now, on the web, I can click Kommende Veranstaltungen [Upcoming events] and it gives me the next plays for that theater. This is still part of the knowledge graph, the displayed search term is maxim gorki theater kommende veranstaltungen. Yet if I try to pass that query to the API to get a JSON of the next plays I am simply returned an empty result.

My query is this: https://kgsearch.googleapis.com/v1/entities:search?query=QUERY&key=API_KEY&limit=1&indent=True

Am I doing this wrong or is this a general limitation of the API? If so, what is the point of this API?

gmolau
  • 2,815
  • 1
  • 22
  • 45

1 Answers1

-1

I'm using the code from https://developers.google.com/knowledge-graph/, It works well

service_url = 'https://kgsearch.googleapis.com/v1/entities:search' params = { 'query': query, 'limit': 10, 'indent': True, 'key': api_key, } url = service_url + '?' + urllib.urlencode(params) response = json.loads(urllib2.urlopen(url).read())

  • That is indeed a standard query that works perfectly well. My question was about subqueries, i.e. queries for items that are connect to a given other item in the graph. – gmolau Jan 08 '18 at 16:09