Managing Fact Sheet Subscriptions

Manage fact sheet subscriptions through the GraphQL API.

Subscriptions let you configure a set of custom permissions and responsibilities in relation to fact sheets for various user groups within your organization. To learn more about subscriptions, see Subscription Roles.

Creating a Fact Sheet Subscription

To create a subscription to a fact Sheet for a user, use the createSubscription mutation. The following arguments are required for this mutation:

  • factSheetId: The ID of the fact sheet to subscribe the user to. To learn how to get the ID of a fact sheet, see Retrieving Fact Sheets.
  • user: The user to be subscribed to a fact sheet. Pass one of the following attributes in the object: id or email.
  • type: The subscription type. For more information, see Subscription Type. Possible values:
    • ACCOUNTABLE: User who carries overall accountability for a fact sheet.
    • RESPONSIBLE: User responsible for keeping the fact sheet data accurate and up to date.
    • OBSERVER: User who follows fact sheet updates.

To specify subscription roles, use the roleIds argument. To retrieve the IDs of subscription roles, use the allSubscriptionRoles query.

Example query:

{
  allSubscriptionRoles {
    edges {
      node {
        id
        name
      }
    }
  }
}

Example response:

{
  "data": {
    "allSubscriptionRoles": {
      "edges": [
        {
          "node": {
            "id": "1d7f3a77-9a33-4029-9077-d21ae4562575",
            "name": "Solution Architect"
          }
        },
        {
          "node": {
            "id": "b4ccabdc-f0c4-4386-8ff0-b54e0882605f",
            "name": "Application Manager"
          }
        }
      ]
    }
  }
}

Once you get all the required parameters, create a subscription using the createSubscription mutation. In the example, we subscribe a user as RESPONSIBLE with the Application Manager subscription role.

Example mutation:

mutation {
  createSubscription(factSheetId: "01740698-1ffa-4729-94fa-da6194ebd7cd", 
  user: {id: "e45f0d10-c59e-4c80-bd56-56b9e7325gf6"}, 
  type: RESPONSIBLE, 
  roleIds: ["b4ccabdc-f0c4-4386-8ff0-b54e0882605f"]) {
    id
    user {
      id
      email
    }
    type
    roles {
      id
      name
    }
  }
}

Example response:

{
  "data": {
    "createSubscription": {
      "id": "abd9ca16-b4a7-4199-a0ad-36e5a6de117b",
      "user": {
        "id": "e45f0d10-c59e-4c80-bd56-56b9e7325gf6",
        "email": "[email protected]"
      },
      "type": "RESPONSIBLE",
      "roles": [
        {
          "id": "b4ccabdc-f0c4-4386-8ff0-b54e0882605f",
          "name": "Application Manager"
        }
      ]
    }
  }
}

Retrieving Fact Sheet Subscriptions

To retrieve all subscriptions for a specific fact sheet, use the factSheet query. id is a required argument for this query. To learn how to get the ID of a fact sheet, see Retrieving Fact Sheets.

Example query:

query {
  factSheet(id: "01740698-1ffa-4729-94fa-da6194ebd7cd") {
    id
    subscriptions {
      edges {
        node {
          id
          user {
            id
            email
          }
          type
          roles {
            id
            name
            comment
          }
        }
      }
    }
  }
}

Example response:

{
  "data": {
    "factSheet": {
      "id": "01740698-1ffa-4729-94fa-da6194ebd7cd",
      "subscriptions": {
        "edges": [
          {
            "node": {
              "id": "abd9ca16-b4a7-4199-a0ad-36e5a6de117b",
              "user": {
                "id": "e45f0d10-c59e-4c80-bd56-56b9e7325gf6",
                "email": "[email protected]"
              },
              "type": "RESPONSIBLE",
              "roles": [
                {
                  "id": "b4ccabdc-f0c4-4386-8ff0-b54e0882605f",
                  "name": "Application Manager",
                  "comment": null
                }
              ]
            }
          }
        ]
      }
    }
  }
}

Updating a Fact Sheet Subscription

Before you update a fact sheet subscription, get the subscription id. To learn how to retrieve all fact sheet subscriptions, see Retrieving Fact Sheet Subscriptions.

To update a subscription, use the updateSubscription mutation. The following arguments are required for this mutation:

  • id: The ID of the subscription.
  • user: The user subscribed to a fact sheet. Pass one of the following attributes in the object: id or email.
  • type: The subscription type. For more information, see Subscription Type. Possible values:
    • ACCOUNTABLE: User who carries overall accountability for a fact sheet.
    • RESPONSIBLE: User responsible for keeping the fact sheet data accurate and up to date.
    • OBSERVER: User who follows fact sheet updates.

In the example, we change the subscription role of the user from Application Manager to Solution Architect using the roleIds argument. You can optionally add a comment.

Example mutation:

mutation {
  updateSubscription(
    id: "abd9ca16-b4a7-4199-a0ad-36e5a6de117b"
    user: {id: "e45f0d10-c59e-4c80-bd56-56b9e7325gf6"}
    type: RESPONSIBLE
    roles: [{id: "1d7f3a77-9a33-4029-9077-d21ae4562575", comment: "Changing the subscription role"}]
  ) {
    id
    user {
      id
      email
    }
    type
    roles {
      id
      name
      comment
    }
  }
}

Example response:

{
  "data": {
    "updateSubscription": {
      "id": "abd9ca16-b4a7-4199-a0ad-36e5a6de117b",
      "user": {
        "id": "e45f0d10-c59e-4c80-bd56-56b9e7325gf6",
        "email": "[email protected]"
      },
      "type": "RESPONSIBLE",
      "roles": [
        {
          "id": "1d7f3a77-9a33-4029-9077-d21ae4562575",
          "name": "Solution Architect",
          "comment": "Changing the subscription role"
        }
      ]
    }
  }
}

Deleting a Fact Sheet Subscription

Before you delete a fact sheet subscription, get the subscription id. To learn how to retrieve all fact sheet subscriptions, see Retrieving Fact Sheet Subscriptions.

To delete a subscription, use the deleteSubscription mutation.

Example mutation:

mutation {
  deleteSubscription(id: "abd9ca16-b4a7-4199-a0ad-36e5a6de117b") {
    id
    name
  }
}

Example response:

{
  "data": {
    "deleteSubscription": {
      "id": "01740698-1ffa-4729-94fa-da6194ebd7cd",
      "name": "AC Management"
    }
  }
}