Example queries for retrieving Fact Sheets through the GraphQL API.
In the example queries in this guide, 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 its ID, use the factSheet
query.
id
is a required argument for this query. To get the ID of a Fact Sheet, navigate to the Fact Sheet page in the application user interface 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 within your workspace, use the allFactSheets
query.
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 Fact Sheets of Specific Types
You can retrieve Fact Sheets of specific types using the FactSheetTypes
facet filter. In the example, we retrieve Application
, ITComponent
, and BusinessCapability
Fact Sheets.
Example query:
query retrieveFactSheetsByType($filter: FilterInput!) {
allFactSheets(filter: $filter) {
totalCount
edges {
node {
id
displayName
type
}
}
}
}
Variables:
{
"filter": {
"facetFilters": [
{
"facetKey": "FactSheetTypes",
"operator": "OR",
"keys": [
"Application",
"ITComponent",
"BusinessCapability"
]
}
]
}
}
Example response:
{
"data": {
"allFactSheets": {
"totalCount": 291,
"edges": [
{
"node": {
"id": "3c86fe91-df46-4fde-8191-6c67253ca91a",
"displayName": "Corporate Services",
"type": "BusinessCapability"
}
},
{
"node": {
"id": "b5e0fc18-bef0-414d-a38a-3409a2f8c01f",
"displayName": "Corporate Services / Fleet Management",
"type": "BusinessCapability"
}
},
...
{
"node": {
"id": "58f554bc-b8f2-487e-b598-df27b4a8e870",
"displayName": "AC Management",
"type": "Application"
}
},
{
"node": {
"id": "91a18208-aade-4a64-ae58-11a6a307a26e",
"displayName": "AC Management Cloud",
"type": "Application"
}
},
...
{
"node": {
"id": "645a6128-6f47-45da-bd88-51ed548c6c44",
"displayName": "Microsoft .NET Framework 1.0 Service Pack 3",
"type": "ITComponent"
}
},
{
"node": {
"id": "5ca2c6e0-7414-4887-9dee-5d0f388cf89f",
"displayName": "Microsoft .NET Framework 1.1",
"type": "ITComponent"
}
},
...
]
}
}
}
For a single Fact Sheet type, you can pass the factSheetType
argument in the allFactSheets
query.
Example query:
{
allFactSheets(factSheetType: Application) {
totalCount
edges {
node {
id
name
type
}
}
}
}
Example response:
{
"data": {
"allFactSheets": {
"totalCount": 50,
"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"
}
},
...
]
}
}
}
Retrieving Fact Sheets with Specific Attributes
You can retrieve Fact Sheets with specific attributes using filters and variable inputs. In the example, we retrieve Application Fact Sheets that have their lifecycle
attribute set to endOfLife
.
Example query:
query allFactSheetsQuery($filter: FilterInput!) {
allFactSheets(filter: $filter) {
totalCount
edges {
node {
... on Application {
id
name
ApplicationLifecycle: lifecycle {
asString
}
}
}
}
}
}
Variables:
{
"filter": {
"facetFilters": [
{
"facetKey": "FactSheetTypes",
"operator": "OR",
"keys": [
"Application"
]
},
{
"facetKey": "lifecycle",
"operator": "OR",
"keys": [
"endOfLife"
],
"dateFilter": {
"type": "TODAY",
"from": "2022-11-27",
"to": "2023-11-27"
}
}
]
}
}
Example response:
{
"data": {
"allFactSheets": {
"totalCount": 25,
"edges": [
{
"node": {
"id": "e5322a3c-c499-4b78-a45a-908a916d9704",
"name": "AutoCAD",
"ApplicationLifecycle": {
"asString": "endOfLife"
}
}
},
{
"node": {
"id": "9dc25869-ff39-46ef-aefb-3b407ffbc9db",
"name": "Bonus Card Asia/Pacific",
"ApplicationLifecycle": {
"asString": "endOfLife"
}
}
},
...
]
}
}
}
Retrieving Custom Attributes for Fact Sheets
Fact Sheets have standard attributes that are defined by the Meta Model configuration. You can add custom attributes to a Fact Sheet to meet your specific requirements. For more information, see Add Fields or Field Values.
To retrieve custom attributes through the GraphQL API, use in-line fragments. For more information, see Inline Fragments in the GraphQL documentation.
The example query returns all Fact Sheets with the following attributes:
- Standard attributes:
id
,name
, andtype
- Custom attributes specific to IT Component Fact Sheets:
capEx
andopEx
We use an in-line fragment ... on ITComponent
to request custom fields for IT Component Fact Sheets. These fields are not 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 Fact Sheets by External ID
You can retrieve Fact Sheets with a specific external ID. In the example, we filter Fact Sheets that have their externalId
attribute set to 1234
.
Example query:
{
allFactSheets(filter: {externalIds: ["externalId/1234"]}) {
totalCount
edges {
node {
id
name
... on Application {
externalId {
externalId
}
}
}
}
}
}
Example response:
{
"data": {
"allFactSheets": {
"totalCount": 1,
"edges": [
{
"node": {
"id": "28fe4aa2-6e46-41a1-a131-72afb3acf256",
"name": "AC Management",
"externalId": {
"externalId": "1234"
}
}
}
]
}
}
}
Retrieving Related and Child Fact Sheets
You can retrieve related and child Fact Sheets for a specific Fact Sheet.
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"
}
}
}
]
}
}
}
}
]
}
}
}
}
Retrieving Archived Fact Sheets
You can retrieve archived Fact Sheets using filters and variable inputs. In the example, we retrieve Fact Sheets that have their status
attribute set to ARCHIVED
.
Example query:
query allFactSheetsQuery($filter: FilterInput!) {
allFactSheets(filter: $filter) {
edges {
node {
id
name
type
status
}
}
}
}
Variables:
{
"filter": {
"responseOptions": {
"maxFacetDepth": 5
},
"facetFilters": [
{
"facetKey": "TrashBin",
"operator": "OR",
"keys": [
"status"
]
}
]
}
}
Example response:
{
"data": {
"allFactSheets": {
"edges": [
{
"node": {
"id": "65e5f779-b7f0-4a1f-9c88-9f0e3ae9bed9",
"name": "Application Hosting",
"type": "ITComponent",
"status": "ARCHIVED"
}
}
]
}
}
}
Retrieving Fact Sheets That a Specific User Is Subscribed To
To retrieve all Fact Sheets that a specific user is subscribed to, use the allFactSheets
query and filter results using the Subscriptions
facet key. The key value is the user id
.
To get the user ID, retrieve all users for your workspace by making a GET
request to the following REST endpoint on the MTM API. To view the endpoint schema, navigate to the OpenAPI Explorer.
/services/mtm/v1/workspaces/{id}/users
Once you get the user id
, use the following query to retrieve Fact Sheets that the user is subscribed to. In the example, we also apply a filter to only return Fact Sheets of the Application type.
Example query:
query retrieveFactSheetsBySubscriber($filter: FilterInput!) {
allFactSheets(filter: $filter) {
totalCount
edges {
node {
id
displayName
type
}
}
}
}
Variables:
{
"filter": {
"facetFilters": [
{
"facetKey": "FactSheetTypes",
"operator": "OR",
"keys": [
"Application"
]
},
{
"facetKey": "Subscriptions",
"operator": "OR",
"keys": [
"87678c21-98a2-9567-acaa-fc66ff2b9d56"
]
}
]
}
}
Example response:
{
"data": {
"allFactSheets": {
"totalCount": 2,
"edges": [
{
"node": {
"id": "01740698-1ffa-4729-94fa-da6194ebd7cd",
"displayName": "AC Management",
"type": "Application"
}
},
{
"node": {
"id": "4d121f64-116b-4ccc-a292-eb4e4f8d1b24",
"displayName": "AC Management Cloud",
"type": "Application"
}
}
]
}
}
}