Documentation Center

GraphQL request for getting all pages tagged with a specific Taxonomy Keyword

This sample imagines that you have created a Category called "City" and have created a Taxonomy of Keywords in this Category, representing various cities.

The following sample request retrieves all pages whose city is set to Night Vale:
{
  items (
    filter: {
      itemTypes: [PAGE],
      keyword: { categoryName: "City", key: "Night Vale" }
    }
  ) {
    edges {
      node {
        ... on Page {
          itemId
          title
          url
        }
      }
    }
  }
}
A response to this query would look something like this (where we imagine three pages tagged with this specific city):
{
  "data": {
    "items": {
      "edges": [
        {
          "node": {
            "itemId": 1025,
            "title": "Night Vale News",
            "url": "/news/night-vale/index.html"
          }
        },
        {
          "node": {
            "itemId": 1088,
            "title": "About Night Vale",
            "url": "/night-vale/about.html"
          }
        },
        {
          "node": {
            "itemId": 1010,
            "title": "Night Vale - Getting Around",
            "url": "/cities/getting-around/night-vale.html"
          }
        }
      ]
    }
  }
}