How to Install WordPress: A Beginner’s Guide

The Knowledge Graph Search API lets you find entities in the Google Knowledge Graph. The API uses standard schema.org types and is compliant with the JSON-LD specification.

Typical use cases #

Some examples of how you can use the Knowledge Graph Search API include:

  • Getting a ranked list of the most notable entities that match certain criteria.
  • Predictively completing entities in a search box.
  • Annotating/organizing content using the Knowledge Graph entities.

Note: The Knowledge Graph Search API is a read-only API.Warning: This API is not suitable for use as a production-critical service. Your product should not form a critical dependence on this API.

For detailed information about the API methods and parameters, see the API Reference.

Sample request #

The following example shows one kind of request you can send to the API. (But check the Prerequisites section first. You’ll also need to insert your own API key.)

{
  "@context": {
    "@vocab": "http://schema.org/",
    "goog": "http://schema.googleapis.com/",
    "resultScore": "goog:resultScore",
    "detailedDescription": "goog:detailedDescription",
    "EntitySearchResult": "goog:EntitySearchResult",
    "kg": "http://g.co/kg"
  },
  "@type": "ItemList",
  "itemListElement": [
    {
      "@type": "EntitySearchResult",
      "result": {
        "@id": "kg:/m/0dl567",
        "name": "Taylor Swift",
        "@type": [
          "Thing",
          "Person"
        ],
        "description": "Singer-songwriter",
        "image": {
          "contentUrl": "https://t1.gstatic.com/images?q=tbn:ANd9GcQmVDAhjhWnN2OWys2ZMO3PGAhupp5tN2LwF_BJmiHgi19hf8Ku",
          "url": "https://en.wikipedia.org/wiki/Taylor_Swift",
          "license": "http://creativecommons.org/licenses/by-sa/2.0"
        },
        "detailedDescription": {
          "articleBody": "Taylor Alison Swift is an American singer-songwriter and actress. Raised in Wyomissing, Pennsylvania, she moved to Nashville, Tennessee, at the age of 14 to pursue a career in country music. ",
          "url": "http://en.wikipedia.org/wiki/Taylor_Swift",
          "license": "https://en.wikipedia.org/wiki/Wikipedia:Text_of_Creative_Commons_Attribution-ShareAlike_3.0_Unported_License"
        },
        "url": "http://taylorswift.com/"
      },
      "resultScore": 4850
    }
  ]
}

The sample search above returns a JSON-LD result similar to the following:

Note: The Knowledge Graph Search API returns only individual matching entities, rather than graphs of interconnected entities. If you need the latter, we recommend using data dumps from Wikidata instead.

The following code samples show how to perform a similar search in various supported languages. This search returns entries matching Taylor Swift.PythonJavaJavascriptPHP

Knowledge Graph entities #

The Knowledge Graph has millions of entries that describe real-world entities like people, places, and things. These entities form the nodes of the graph.

The following are some of the types of entities found in the Knowledge Graph:

Was this page helpful?

Powered by BetterDocs

We will be happy to hear your thoughts

      Leave a reply