Skip to main content
Solved

GraphQL query problem

  • Sep 25, 2024 8:46 AM UTC
  • 2 replies
  • 30 views

yaquaholic
Forum|alt.badge.img

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 been building the query up, but I'm getting lost on the eventPolicySuppressions.
Here's the code:

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}} } }

I only seem to be able to get the entity {_typename} (which is "device") or the entityType ("entityType": "device") as a result. There don't appear to be any other options being offered from the UI suggestions.

Does anyone know how I can get the eventPolicySuppressions device or device groups information?

Thanks,
Richard

 

Best answer by Anonymous

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 } } } } }

 

View original

2 replies

  • Answer
  • Sep 25, 2024 1:39 PM UTC

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 } } } } }

 


yaquaholic
Forum|alt.badge.img
  • Author
  • Contributor II
  • Sep 26, 2024 3:24 PM UTC

Hi Chris,

Perfect, thank you sir!