api-preview-docs icon indicating copy to clipboard operation
api-preview-docs copied to clipboard

List projects by organisation

Open cob16 opened this issue 5 years ago • 5 comments

As a circle ci user, I would like to able to discover projects in any org via the API. Personally, this is so that I can do extended build statistics in a particular org.

Current workarounds

The current ways to get a list of repositories are very problematic.

  1. The v1 API has an endpoint that lists followed projects https://circleci.com/api/v1/projects. But this lists only my currently followed projects meaning that any program needs maintenance in that its account needs to have all projects followed.

  2. Using the GitHub API to list repositories https://api.github.com/users/cob16/repos and then trying to fetch all of these projects in circle ci. Of course, not all repositories will be set up to use circle ci to this is a very error-prone way to get a list

Suggested new route

The v2 API could have a way to list projects by the organisation

  1. As there is already a GET v2/projects/gh/<org>/<project>route for a single project. An extension to this would be v1/projects/gh/<org> (without the repo name part) that returns a list of projects
  2. The user route could list a user's projects via /v1/user/<org>/projects

cob16 avatar Oct 22 '19 12:10 cob16

Pinging the CircleCI team on this. This missing means that there's no way to traverse the full data model without a user manually providing the names of projects they want to use. This means that making relatively generic clients is not possible.

danpalmer avatar Mar 14 '20 21:03 danpalmer

@danpalmer Any update on the same? I'm looking for an endpoint(v1/projects/) to list all the projects of an organization.

vinitshahdeo avatar Apr 11 '21 19:04 vinitshahdeo

@cob16 https://github.com/CircleCI-Public/api-preview-docs/issues/97#issuecomment-1049449891

stiyyagura0901 avatar Feb 24 '22 03:02 stiyyagura0901

@stiyyagura0901 the all-projects field under the metrics section does not provide all the projects part of the organisation. Anyone knows the reason?

Swaminathan11 avatar Aug 08 '22 10:08 Swaminathan11

There is an endpoint that has a list of all the pipelines. https://circleci.com/docs/api/v2/index.html#operation/listPipelines Each pipeline contains VCS details such as target_repository_url . I have not tested it yet, but would this be a good workaround ?

nickologist avatar Jan 16 '23 14:01 nickologist