Working with the Knowledge Graph API (Practical)
Please purchase this course, or sign in if you’re already enrolled, to access the course content.
Lesson overview
The Knowledge Graph API makes Google’s Knowledge Graph usable as a research and diagnostic tool. This practical lesson walks through a Google Colab notebook of exercises designed to get you working with the API, from looking up a single entity to clustering a keyword list by the entities it contains. It then shows how to adapt the functions so they fit real SEO workflows.
What this lesson covers
- Querying the Knowledge Graph for detailed information about an entity and exporting it
- Discovering entities related to a known entity or keyword
- Measuring how popular an entity is in the Knowledge Graph
- Clustering keywords based on the entities they reference
- Handling API quotas when working with large keyword sets
- Adapting inputs and outputs with CSV, Google Sheets and Apps Script
The exercises build up step by step. First you explore the Knowledge Graph for a chosen entity, controlling how many results are returned and exporting a detailed dataset. Next you look up entities related to a keyword, which helps reveal the conceptual neighbourhood around a topic. The popularity exercise returns a score for an entity, which the lesson suggests using to prioritise the entities you found in earlier entity analysis work, for example when building a topical map. The clustering exercise groups keywords by the related entities found in the Knowledge Graph, and you can extend it to loop through your full keyword universe. For large lists, the lesson reminds you to check and handle API quotas.
The second half focuses on making the notebook practical. The suggested adaptations include reading from and writing to CSV files or Google Sheets instead of working with typed text, and extending the functions to export more Knowledge Graph fields based on your research needs. You can also change the input to Search Console queries, competitor keywords or competitor content, so you identify entities from those sources and check their popularity. Finally, Apps Script can be used to automate regular monitoring of the Knowledge Graph signals that matter to a project, such as entity popularity, and feed them into reporting. The lesson is clear that some customisation is needed to make the functions fully useful for your situation.
This is the practical lesson in the optional Introduction to Knowledge Graphs primer, and it complements the Knowledge Graph exercises in the core modules. It suits technical SEOs and data-minded marketers who want hands-on experience with the API for semantic keyword research.