Forum Discussion

Billy's avatar
Billy
Comet
3 months ago
Solved

API Request to get all SDP users

Hi everyone,

I'm trying to get all users within my Cato platform. Like in Access > Users when you select SDP Users Activity. 

 

I cannot find any direct way to do it, maybe i'm missing something ?

I tried with AccountSnapshot but here you can only find connected users, it is also stated that if I want users that are offline I need to specify the ID, is it the only way to do it ? 

Thanks,

Billy

  • Hi Billy,

    Take a look at the entityLookup. I was able to view our SDP users with it.

    query: "query GetVpnUsers($accountID: ID!, $limit: Int = 25, $from: Int = 0) {
      entityLookup(
        accountID: $accountID,
        type: vpnUser, 
        limit: $limit,
        from: $from
      ) {
        items {
          entity {
            id
            name
            type
          }
         description
        }
        total
      }
    }"
    variables: "{
        "accountID": "12345"
    }"

     

  • Hi Billy,

    Take a look at the entityLookup. I was able to view our SDP users with it.

    query: "query GetVpnUsers($accountID: ID!, $limit: Int = 25, $from: Int = 0) {
      entityLookup(
        accountID: $accountID,
        type: vpnUser, 
        limit: $limit,
        from: $from
      ) {
        items {
          entity {
            id
            name
            type
          }
         description
        }
        total
      }
    }"
    variables: "{
        "accountID": "12345"
    }"

     

    • Brian-Anderson's avatar
      Brian-Anderson
      Icon for Cato Employee rankCato Employee

      Hi, 

      Exactly right, the entityLookup gets you the data you are looking for.  Also, I recommend running the api explorer app (dockerized app available on github), which helps you easily generate queries for any of the latest APIs from with all of the parameters presented in easy to use HTML elements.

      https://github.com/catonetworks/cato-api-explorer

       

      • Billy's avatar
        Billy
        Comet

        Thanks 😁, I'm just starting with the API and didn't know about this tool! 

    • Billy's avatar
      Billy
      Comet

      Hi JessieBryan,

      Thanks a lot! It worked very well.