→ 🚀What's New? Explore Lansweeper's Fall 2024 Updates! Fall Launch Blog !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gschally
Engaged Sweeper

We are integrating calls to the Lansweeper API for a client.  When a user calls in to the helpdesk we would like to lookup their Lansweeper data and display some information for the helpdesk agent. 

We have successfully set up our API access and are authenticating and getting an access token. We can test various GraphQL queries using Postman, but when we try to lookup account data for a use we are failing. We tried the example in the documentation at this link for getting authorized accounts, realizing we would have to filter it:

https://docs.lansweeper.com/docs/api/getting-data#get-asset-details

under heading "Listing authorized accounts", but we get 403 - Unauthorized.  Our account has full admin rights. 

Can you please advise the best way to do this?

Thanks,

George S.

 

 

1 ACCEPTED SOLUTION
David_GF
Lansweeper Tech Support
Lansweeper Tech Support

Hi @gschally 

You can pull the list of the email address for all the a authorized accounts using the code below, and then search the result with CTRL+F:

 

{
  site(id: "XXXXXXXX-XXXX-XXXXX-XXXX") {
    accounts
    {
      username
      email
      status
      createdAt
      joinedAt
      lastTimeAccess
    }
  }
}

There does not seem to be a function to filter by email address.



~~~~~~~ (〃 ̄︶ ̄)人( ̄︶ ̄〃) ~~~~~~~
Sweep that LAN, sweep it!

View solution in original post

5 REPLIES 5
gschally
Engaged Sweeper

Hi @@David_GF , thank you, that permission fixed it for us.  Question, we are trying to retrieve the account data but filter it by email address, so we only get one account back.  We are not having any luck, getting a syntax error returned. Here is what we are passing. Can you tell us what limitations there are on filtering fields?

{
  site(id: "XXXXXXXX-XXXX-XXXXX-XXXX") {
    accounts (email: "gschally@xxx.com")
    {
      username
      email
      status
      createdAt
      joinedAt
      lastTimeAccess
    }
  }
}
David_GF
Lansweeper Tech Support
Lansweeper Tech Support

Hi @gschally 

You can pull the list of the email address for all the a authorized accounts using the code below, and then search the result with CTRL+F:

 

{
  site(id: "XXXXXXXX-XXXX-XXXXX-XXXX") {
    accounts
    {
      username
      email
      status
      createdAt
      joinedAt
      lastTimeAccess
    }
  }
}

There does not seem to be a function to filter by email address.



~~~~~~~ (〃 ̄︶ ̄)人( ̄︶ ̄〃) ~~~~~~~
Sweep that LAN, sweep it!
gschally
Engaged Sweeper

Hi David, thank you for the reply.  I am in the dashboard "Users" screen, and I don't see where permissions can be set. Can you advise?

David_GF
Lansweeper Tech Support
Lansweeper Tech Support

Hi @gschally To manage the user permissions, you need to go to Configuration (the cog icon) > Account Management. You can adjust the Scopes and Roles and Permissions in that section. More information can be found in this knowledge base article: https://community.lansweeper.com/t5/cloud/configure-scopes-permissions-and-roles/ta-p/64512 



~~~~~~~ (〃 ̄︶ ̄)人( ̄︶ ̄〃) ~~~~~~~
Sweep that LAN, sweep it!
David_GF
Lansweeper Tech Support
Lansweeper Tech Support

Hi @gschally, when using the Lansweeper API to access account data, just make sure that the user making the request has the right permissions, especially the "View accounts" permission. If you see a 403 - Unauthorized error, it's likely because of not having enough permissions.



~~~~~~~ (〃 ̄︶ ̄)人( ̄︶ ̄〃) ~~~~~~~
Sweep that LAN, sweep it!

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now