Question

Is there an API method for searching BC users and filtering by field? I’m hoping to do somethin...


Badge +1

Is there an API method for searching BC users and filtering by field? I’m hoping to do something similar to what is possible in the webUI
screen_shot_2020-07-07_at_11.17.55_am.png?pub_secret=fb01c4a348



🗨 Link to Slack thread

15 replies

Badge +1

Seems like the frontend UI is using https://app.bettercloud.com/directory/users/v1/auth/saasusers is it possible to query that programmatically?

Userlevel 5
Badge +2

You may be able to filter in that way via our GraphQL endpoint: https://developer.bettercloud.com/#/reporting/explore

Badge +1

Yep, for example you can do a GET https://api.bettercloud.com/api/graphql?query="{saasusers(filter: {displayValue: {eq: "justin.little"}}) { id }}" , this will return all the saas user accounts associated with display name “justin.little”

Badge +1

https://developer.bettercloud.com/#/reporting/graph - this shows you all the different objects within the Graph API you can access, and you can use the link Mike posted to test the queries out

Badge +1

Great! Thanks for the tip on the GraphQL viewer and explorer!

Userlevel 5
Badge +2

@justin.little ftw!

Badge +1

Is it possible that Employee ID is a filterable field in the front-end and not in the API?

Badge +1

ID in saasuser is not the same thing apparently

Badge +1

I believe these are the only filterable fields (SaaSUserFilter): https://screenshots.bettercloud.com/nOueQeOW

Badge +1

For example, the front end query looks like this:
((employee_id.lowercase=="1045"))
But testing the graphql query with employee_id returns this error:
contains a field not in 'SaasUserFilter': 'employee_id'"

Badge +1

Is this employeeId field coming from G Suite, Okta, etc?

Badge +1

Yes, Gsuite

Badge +1

I’ll have to circle back to see if that employeeId field is accessible via the saasuser object

Badge +1

Thanks Justin! That would be great. I’m trying to transform an employee ID value to a primary email address via a inbound request transformer

Badge +1

Nice! I’ll try to find that answer for you asap Gillen!

Reply