Retrieving Fact Sheets

Example queries for retrieving fact sheets through the GraphQL API.

In the example queries, we only retrieve basic fact sheet attributes, such as id, name, or type. Modify the queries to retrieve the data you need.

📘

Note

Within the GraphiQL interface in your workspace, there is a response limit of 18,006 nodes. For workspaces with large data volumes, this node limit may result in not all fact sheets being included in the response. We recommend implementing pagination and limiting your retrieval to no more than 1,000 fact sheets per page. To learn more about pagination, see Pagination in GraphQL.

Retrieving a Fact Sheet by ID

To retrieve a fact sheet by ID, use the factSheet query.

The id argument is required for this query. To find the ID of a fact sheet, navigate to the fact sheet page and copy the ID from the URL.

Example query:

{
  factSheet(id: "28fe4aa2-6e46-41a1-a131-72afb3acf256") {
    id
    name
    type
  }
}

Example response:

{
  "data": {
    "factSheet": {
      "id": "28fe4aa2-6e46-41a1-a131-72afb3acf256",
      "name": "AC Management",
      "type": "Application"
    }
  }
}

Retrieving All Fact Sheets

To retrieve all fact sheets available in the inventory, use the allFactSheets query.

👍

Tip

You can apply filters to your queries to narrow down results. For example queries with filters, see Filtering Fact Sheets.

Example query:

{
  allFactSheets {
    totalCount
    edges {
      node {
        id
        name
        type
      }
    }
  }
}

Example response:

{
  "data": {
    "allFactSheets": {
      "totalCount": 132,
      "edges": [
        {
          "node": {
            "id": "28fe4aa2-6e46-41a1-a131-72afb3acf256",
            "name": "AC Management",
            "type": "Application"
          }
        },
        {
          "node": {
            "id": "2efa37b5-18aa-48d8-9d70-1328c0d856d7",
            "name": "AC Management Cloud",
            "type": "Application"
          }
        },
        {
          "node": {
            "id": "688f3195-3634-418a-8ad9-a3555bb358a9",
            "name": "AC Management to HR Admin",
            "type": "Interface"
          }
        },
        ...
      ]
    }
  }
}

Retrieving Data Specific to Fact Sheet Types

You can retrieve data specific to a certain fact sheet type using inline fragments. To understand how inline fragments work in GraphQL, refer to Inline Fragments in the GraphQL documentation.

Retrieving Custom Fact Sheet Attributes

Fact sheets come with standard attributes defined in the meta model configuration. You can also add custom attributes to a fact sheet to tailor the configuration to your needs. For more details, see Addding Custom Attributes.

The following example query returns all fact sheets with these attributes:

  • Standard fields: id, name, and type
  • Custom fields specific to IT component fact sheets: capEx and opEx

We use an inline fragment ... on ITComponent to request custom fields for IT component fact sheets. These fields aren't returned for other types of fact sheets.

Example query:

{
  allFactSheets {
    totalCount
    edges {
      node {
        id
        name
        type
        ... on ITComponent {
          capEx
          opEx
        }
      }
    }
  }
}

Example response:

{
  "data": {
    "allFactSheets": {
      "totalCount": 120,
      "edges": [
        {
          "node": {
            "id": "28fe4aa2-6e46-41a1-a131-72afb3acf256",
            "name": "AC Management",
            "type": "Application"
          }
        },
        {
          "node": {
            "id": "9deb9733-5701-42f1-8c52-c165acaa6487",
            "name": "App Maintenance & Support Service",
            "type": "ITComponent",
            "capEx": 2000,
            "opEx": 1500
          }
        },
        ...
      ]
    }
  }
}

Retrieving Related Fact Sheets

You can retrieve related fact sheets for a specific fact sheet using an inline fragment.

In the example, we retrieve the following data for a specific fact sheet of the IT component type:

  • All related fact sheets of the tech category type, referred to as TechnicalStack in the GraphQL API
  • All child fact sheets and their related fact sheets of the tech category type

Example query:

{
  factSheet(id: "afd31c81-3fff-4367-9d90-458eecb3efa7") {
    name
    type
    ... on ITComponent {
      relITComponentToTechnologyStack {
        edges {
          node {
            id
            factSheet {
              name
            }
          }
        }
      }
      relToChild {
        edges {
          node {
            id
            factSheet {
              name
              type
              ... on ITComponent {
                relITComponentToTechnologyStack {
                  edges {
                    node {
                      id
                      factSheet {
                        name
                        type
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

Example response:

{
  "data": {
    "factSheet": {
      "name": "Application Hosting",
      "type": "ITComponent",
      "relITComponentToTechnologyStack": {
        "edges": [
          {
            "node": {
              "id": "5628093c-6106-4ead-a02d-86d5e7e21a3a",
              "factSheet": {
                "name": "Hosting"
              }
            }
          }
        ]
      },
      "relToChild": {
        "edges": [
          {
            "node": {
              "id": "08bde56f-ea78-438c-975a-7667a4be7caf",
              "factSheet": {
                "name": "Application Development",
                "type": "ITComponent",
                "relITComponentToTechnologyStack": {
                  "edges": [
                    {
                      "node": {
                        "id": "8834a6a8-c73e-4c79-91ea-a3aed3bc9b59",
                        "factSheet": {
                          "name": "Design & Development",
                          "type": "TechnicalStack"
                        }
                      }
                    }
                  ]
                }
              }
            }
          }
        ]
      }
    }
  }
}