Forum Discussion

Ishanc's avatar
Ishanc
Icon for Contributor II rankContributor II
7 days ago

API to get devices aligned to a dynamic app

Hey, I am wondering if there is an API logic to get all devices aligned to a snippet performance dynamic application ? regardless of whether they are collecting any data or not.

  • So I am not too familiar with the API, but a quick search doesn't look like you can. I am more familiar with the GQL side and it is possible to get it that way though. 

    This is an example that will get the devices aligned to the "BGP Peer Statistics" Snippet Performance Dynamic Application. I have it limited to 2 devices, first: 2 at the end, but you can put whatever number you want there. It is also only returning the device ID and name from the system for those that match it, but you can get more or less fields if you want. You can replace the Dynamic Application name with whatever one you want to target to get the info from as well.

    {
      devices(search: {alignedDynamicApplication: {has: {dynamicApplication: {has: {name: {eq: "BGP Peer Statistics"}}}}}}, first: 2) {
        edges {
          node{
            id
            name
          }
        }
        pageInfo {
          matchCount
        }
      }
    }

     

  • So I am not too familiar with the API, but a quick search doesn't look like you can. I am more familiar with the GQL side and it is possible to get it that way though. 

    This is an example that will get the devices aligned to the "BGP Peer Statistics" Snippet Performance Dynamic Application. I have it limited to 2 devices, first: 2 at the end, but you can put whatever number you want there. It is also only returning the device ID and name from the system for those that match it, but you can get more or less fields if you want. You can replace the Dynamic Application name with whatever one you want to target to get the info from as well.

    {
      devices(search: {alignedDynamicApplication: {has: {dynamicApplication: {has: {name: {eq: "BGP Peer Statistics"}}}}}}, first: 2) {
        edges {
          node{
            id
            name
          }
        }
        pageInfo {
          matchCount
        }
      }
    }