Seach for user in org using the Rest API

Hi!

I am trying to search for users in a Github organization using the rest API.

I found the members list query that doesn’t allow searching, and I found the user search query that apparently doesn’t allow filtering by organization.

I basically want something in between these two queries but couldn’t find it.

Is there another way to do it that I am missing?

@tomer-amir 

You can check the user in an organization using this API

https://developer.github.com/v3/orgs/members/#check-membership

It will return 404 if the user is not in the organization

It will return 202 if the user is in the organization

Thanks @parithiban but this does not help my use case :pensive:

I don’t have a list of users I want to check, I need to search in the users that belong to the organization.

@tomer-amir 

Could you elaborate your use case a bit more?

I am trying to auto-assign issues in a repo to an organization member through a UI that I am building.

I want the UI to suggest existing organization members according to the user input (auto-complete)

To my understanding I don’t think so there is a direct API available to achieve your use case. But you can implement it in any of the following logic

  1. You can create a new webhook and subscribe to an organization event. Once the member is added it will call to the payload URL you can append the data in a common place and retrieve it on your need.
  2. You can call the members list API and get stored in any caching mechanism such as Redis. And update data frequently using any script.
2 Likes

yeah… it’s a good idea I was hoping to avoid all that :confused:

I don’t want to start maintaining a cache for this