Skip to main content
Solved

How to get all Application Factsheets from REST API

  • 9 August 2024
  • 6 replies
  • 89 views

I’ve been trying to pull all application Factsheets from the /factsheet API, specifying criteria in the body such as the “type” and a few select “fields” I want, and setting “false” values on things like tags and subscriptions. However, when running the request, I still get all factsheets regardless of type, all fields, all tags, all subscriptions etc. 

I must be doing something wrong, but I am not sure what. Any ideas or any examples how I can use the GraphQL API to do this (I’m unfamiliar with GraphQL so I’ve been sticking to REST)?

Thanks in advance!

Hi @Graham ,

There is good documentation with many examples here: https://docs-eam.leanix.net/reference/graphql-tutorials and the other pages in that section.

There are also examples in the LeanIX public github repos: https://github.com/leanix-public with various GraphQL examples (look in the script repository for some).

Due to the relationship-heavy LeanIX Meta Model, you will find that GraphQL makes things much simpler once you get used to it.

Check this topic for an example of finding Applications fact sheets will some facetFilters criteria: 

Hope it helps getting you onto the GraphQL track.

Cheers,


Hi @Graham, if you want the flexibility and the power of GraphQL without having to learn GraphQL, you can have a look at our Python LeanIX Client. It is part of LeanIX Automation Platform, and there are tons of examples online, especially for using the filters that you mention.

Online demo: https://demo.aronis.de

Facet filter examples: https://doc.aronis.de/utils/fact_sheet.html#FactSheet.filter


Hi @Graham ,

There is good documentation with many examples here: https://docs-eam.leanix.net/reference/graphql-tutorials and the other pages in that section.

There are also examples in the LeanIX public github repos: https://github.com/leanix-public with various GraphQL examples (look in the script repository for some).

Due to the relationship-heavy LeanIX Meta Model, you will find that GraphQL makes things much simpler once you get used to it.

Check this topic for an example of finding Applications fact sheets will some facetFilters criteria: 

Hope it helps getting you onto the GraphQL track.

Cheers,

 

Thanks for the info. I had looked through the documentation for GraphQL but I have no idea how I’m supposed to pass through a GraphQL query in a JSON payload via a web request (it has to be a web request, I can’t use a scripting language to do this). The documentation provides examples of the queries, but not examples of how to send those queries - which is where I’m mostly stuck. 

 

I’m confused why the REST API call isn’t even working properly either, I thought I had that configured correctly (see below), but it brings back ALL factsheet types and fields regardless of the limitations I pass through in the body of the call:

{
"type": "Application",
"fields": "DRTargetTier,name,CurrentStatus,displayName,alias,ColumbiaDescription",
"pageSize": "40"
}

 

 

EDIT: I’ve found a tool to convert GraphQL to JSON, so I think I have a way forward now. Thanks again!


I have a new issue with the GraphQL query, appreciate any help.

I have this query and I want to only pull back subscriptions where the subscription role name = Application Owner. 

query AllFactSheets {
allFactSheets(factSheetType: Application) {
edges {
node {
id
name
type
... on Application {
DRTargetTier
CurrentStatus
Description
BusinessImpact
subscriptions {
edges {
node {
user {
displayName
}
roles(filter: {name: "Application Owner"}) {
name
}
}
}
}
}
}
}
}
}

Using the above query gives an error (Validation error of type UnknownArgument: Unknown field argument filter) - So I presume either a) I can’t filter on the role name, or b) I’m misformatting it? 


.


I have a new issue with the GraphQL query, appreciate any help.

I have this query and I want to only pull back subscriptions where the subscription role name = Application Owner. 

 

For the record: @Helder.Luz answered this question in this thread.


Reply