Documentation Center

List a Contentful folder

Use the externalItems GraphQL query to retrieve a list of items in a Contentful folder.

Example request

The first sample code block illustrates a request to retrieve all the Contentful items under a specified folder.

{
  externalItems(
    namespace: "contentful", 
    filter: {
      context: {
        type: "ContentfulStatus",
        id: "Published_Status_bbfjpm3r9zf3"
      }
    }) {
    edges {
      node {
        ... on ContentfulArticle {
          title
        }
      }
    }
  }
}

Example response

The second code block illustrates the corresponding response with the requested data for each Contentful folder.

{
  "data": {
    "externalItems": {
      "edges": [
        {
          "node": {
            "identity": {
              "id": "31TNnjHlfaGUoMOwU0M2og_Article_bbfjpm3r9zf3",
              "type": "ContentfulArticle"
            },
            "title": "Automate with webhooks"
          }
        },
        {
          "node": {
            "identity": {
              "id": "2PtC9h1YqIA6kaUaIsWEQ0_Article_bbfjpm3r9zf3",
              "type": "ContentfulArticle"
            },
            "title": "Static sites are great"
          }
        }
      ]
    }
  }
}