Manage fact sheet resources through the GraphQL API.
To store additional information on a fact sheet, you can add the following resources to it: links, files, diagrams, and logos. To learn how to work with resources in the application user interface, see Store Resources on Fact Sheets.
Note
In the LeanIX GraphQL API, fact sheet resources are referred to as documents.
Creating a Resource on a Fact Sheet
To create a resource on a fact sheet, use the createDocument
mutation. factSheetId
is a required argument for this mutation. To learn how to get the ID of a fact sheet, see Retrieving Fact Sheets.
In the example, we add a link to a fact sheet as a resource.
Example mutation:
mutation createDocument {
createDocument(
factSheetId: "01740698-1ffa-4729-94fa-da6194ebd7cd"
name: "Website link"
url: "https://www.leanix.net/"
description: "Link to the LeanIX website"
) {
id
name
url
description
factSheetId
}
}
Example response:
{
"data": {
"createDocument": {
"id": "fc87eb51-0f2e-4b77-9df3-f6325b6836fd",
"name": "Website link",
"url": "https://www.leanix.net/",
"description": "Link to the LeanIX website",
"factSheetId": "01740698-1ffa-4729-94fa-da6194ebd7cd"
}
}
}
Retrieving Fact Sheet Resources
To retrieve resources stored on a specific fact sheet, use the factSheet
query. The fact sheet id
is a required argument for this query.
Example query:
{
factSheet(id: "4d121f64-116b-4ccc-a292-eb4e4f8d1b24") {
id
name
documents {
edges {
node {
origin
url
name
id
}
}
}
}
}
Example response:
{
"data": {
"factSheet": {
"id": "4d121f64-116b-4ccc-a292-eb4e4f8d1b24",
"name": "AC Management Cloud",
"documents": {
"edges": [
{
"node": {
"origin": "CUSTOM_LINK",
"url": "https://www.leanix.net/",
"name": "Website link",
"id": "22b9ed8f-5dea-48e8-b9c4-d7db97a811e4"
}
}
]
}
}
}
}
Updating a Resource on a Fact Sheet
To update a resource on a fact sheet, use the updateDocument
mutation. id
is a required argument for this mutation. To get the resource ID, retrieve all fact sheet resources and copy the id
from the response. To learn more, see Retrieving Fact Sheet Resources.
To update specific fields on a resource, apply patch operations. In the example, we change the link URL using the replace
patch operation.
Example mutation:
mutation updateDocument($patches: [Patch]!) {
updateDocument(id: "22b9ed8f-5dea-48e8-b9c4-d7db97a811e4", patches: $patches) {
id
name
url
}
}
Variables:
{
"patches": [
{
"op": "replace",
"path": "/url",
"value": "https://www.leanix.net/de/"
}
]
}
Example response:
{
"data": {
"updateDocument": {
"id": "22b9ed8f-5dea-48e8-b9c4-d7db97a811e4",
"name": "Website link",
"url": "https://www.leanix.net/de/"
}
}
}
Deleting a Resource from a Fact Sheet
To delete a resource from a fact sheet, use the deleteDocument
mutation. id
is a required argument for this mutation. To get the resource ID, retrieve all fact sheet resources and copy the id
from the response. To learn more, see Retrieving Fact Sheet Resources.
Example mutation:
mutation {
deleteDocument(id: "a1904f80-f9b8-4fd6-848c-bad1f55192d2") {
name
}
}
Example response:
{
"data": {
"deleteDocument": null
}
}