Search users in organization using Github Rest API - github

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?

Related

Azure Devops API - Can't find a way to get permission groups/membership using API

I am looking for a way to use the Azure DevOps API to get membership of permission groups. The data I am looking for is in the following location on the front end:
I had the same requirement to get team membership within Azure DevOps and was able to do so using the following URI:
https://dev.azure.com/{organization}/_apis/projects/hrs/teams/{teamname}/members?api-version=6.0
I could not find a similar URI to get permission groups and need a way to pull this information using the API.
I've tried many of the API endpoints on the official api documentation (below) focusing on any that seem like they may pull security group related information. In all cases I came up short either because the endpoint did not provide me with what I was looking for, or the documentation for an endpoint wasn't clear on how parameters need to be structured for more advanced use cases.
https://learn.microsoft.com/en-us/rest/api/azure/devops/graph/groups/get?view=azure-devops-rest-7.0&tabs=HTTP
I also tried asking this question to ChatGPT however the endpoints the chatbot provided me with did not work either.
I found a way to get what I am looking for, but I am not a big fan of the approach.
You can use the graph API to list all permission groups
once you have the permission groups, you can write a script to filter for the group object within the API response you want to get the members of.
The group object has the appropriate API endpoint to hit to get the member objects within the _links.memberships property.
Call the API with the memberships link from above. It will return an array of descriptors which can be used in further API calls.
For each descriptor, hit the appropriate API endpoint to resolve the object for that descriptor. If the descriptor starts with aad then it is a user and you can use the user get api. If the descriptor starts with aadgp then it is a group and you use the group get api.
This strategy is rather complicated and requires an API call for each member of the group. I'd hope there is a better solution.

Azure DevOps SaaS - Unable to distinct group and team name in REST API

I am trying to retrieve only the groups of an organization , example for a project in Project settings -> General -> Permissions , I would like to retrieve only the Type as "Group" . When using the below REST API, I get the Type "Team" also .
Rest API used - https://vssps.dev.azure.com/{CollectionName}/_apis/graph/groups?api-version=7.0-preview.1
How can I get the groups alone instead of getting Team names also.
Currently, here is not a directly way to realize it. For even in UI if you go to organization settings->permission you could not directly see type 'Team'.
But here is an idea for your reference. For we get rest api Groups - List(return include Teams in the org and groups in the org) and rest api Teams - Get All Teams, you could write your script to filter the Teams from the second rest api return from the first return one.
But if you do need the direct feature, we recommend that you can directly report the feature requests: https://developercommunity.visualstudio.com/report?space=22&entry=suggestion. That will allow you to directly interact with the appropriate engineering team and make it more convenient for the engineering team to collect and categorize your suggestions.

Get the list of maintainers in GitHub GraphQL API?

I would like to use the GitHub GraphQL API to fetch a list of accounts that have control of a given public repo.
This would include anyone who can:
Make commits
Approve pull requests
Create releases
Administrate the repo
etc.
Is this possible using the GraphQL API? And if so, what would the query be?
This isn't possible in the general case. There's the concept of secret teams where the users aren't publicly visible, and those teams can have access to repositories. The REST API endpoints don't allow you to query the team list of an arbitrary public repository, so the GraphQL endpoints won't allow that, either.

How to get github users from city using Github REST API?

Background
I am working on an app and I need to get all the projects of all github users that live in a given city using the GitHub Rest API v3: https://developer.github.com/v3/
Research
Now I know I can get all the users with the following url:
https://api.github.com/users
And once I have a user, I can get all his repos and info from there.
Problem
The problem is that I don't know how to filter those users by city!
I have tried adding a paramter location=London but it always returns the same, probably because this is not the real parameter...
Another option would be to get all the github users from the world, and then filter them by city .... which would be totally insane.
The best option I found so far was to use this link:
https://github.com/search?q=language:javascript+location:Barcelona&type=Users
However, this link is the web version, which does not use the REST API.
Question
How do I get all the users from a given city using the Github REST API?
You are using the /users endpoint. You need to use the /search/users endpoint:
https://api.github.com/search/users?q=location%3Aiceland
Will search for users located in Iceland
Using that gets me a response with a bunch of users and after cross checking the first 3, they all have their location set to "Iceland" in their profiles.

how to get facebook search results

I am trying to build a network of people that match a search criteria on FB and get their friends. All public information of course, or at least accessible to my own account. Say I search for the name "Smith".
I want to get all the people that match that query, then search in their connections all those names that match "Smith" and the relationship to each others and so on. This way I create clusters of the various interconnected "Smith"(es).
I am fluent with R and so I tried the Rfacebook package. There is a function there called searchFacebook but it does not work anymore, because the API search was disabled by Facebook itself. for info I get:
Searching for posts was deprecated with version 2.0 of the Facebook Graph API.
What options do I have in this case? Is this even possible?
The language is not an issue, I can use Python too. I just used R cause it's faster for me.
Thanks