Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 2

Get top 10 organizations with the GraphQL API

Solved! Go to Solution.

Hi,

 

Is it possible to get top 10 organizations which have a number of members, with the GraphQL API?

 

I'd like to analyze like this: 

https://resources.whitesourcesoftware.com/blog-whitesource/git-much-the-top-10-companies-contributin...

 

I was able to list 10 organizations by this query:

 

query {
  search(first: 10, type: USER, query: "type:org"){
    userCount
    edges{
      node{
        ... on Organization {
          name
          membersWithRole{
            totalCount
          }
        }
      }
    }
  }
}

 

 

But I cannot find the right queryString for sorting by  the number of members.

 

Regarding repositories, there is an undocumented scalar field: "stars". By using this, we can compare repositories by the number of stars. Is there some similar undocumented scalar fields on the organizaition?

 

1 Reply
Solution
Community Manager
Message 2 of 2

Re: Get top 10 organizations with the GraphQL API

There isn't a method to sort organizations by the number of members. You could iterate through all of them and sort them yourself though.

 

I hope that helps!