Forum Discussion

yaquaholic's avatar
yaquaholic
Icon for Contributor II rankContributor II
2 months ago

GraphQL query problem

I'm trying to use GQL to extract detail about our event policies, as the API give very little detail. And as we have a SL hosted system, DB access is only available to us via the Web UI.  I've be...
  • chris_thornton's avatar
    2 months ago

    Hi Richard,

    You need to use an inline fragment to get more details. You can do something like the below to get more of what you want for each type, device or devicegroup, and add additional fields from there. Hope that helps!

    query Event_Policies {
      eventPolicy(id: 4075) {
        id
        name
        editedBy {
          id
          user
        }
        dateEdited
        severity {
          id
          name
        }
        enabled
        source {
          name
        }
        regularExpression1
        regularExpression2
        regularExpressionSearch
        autoClearedEvents {
          id
          name
          editedBy {
            user
          }
        }
        eventPolicySuppressions {
          entity {
            __typename
            ... on DeviceGroup {
              groups {
                id
              }
            }
            ... on Device {
              id
            }
          }
        }
      }
    }