CircleCI-Archived / api-preview-docs

In-progress docs about the pre-release preview of CircleCI API v2
72 stars 39 forks source link

List projects API (v2) is missing #97

Open vinitshahdeo opened 3 years ago

vinitshahdeo commented 3 years ago

Hello 👋

I am looking for an endpoint which can help us list all the projects within an organization (or the projects the user has access to). However we have an endpoint(v1/projects) in CircleCI API (v1) which returns the projects followed by the user.

A route like GET /v2/projects should list all the projects the user has access to.

stiyyagura0901 commented 2 years ago

if it helps

$ curl --location --request GET 'https://circleci.com/api/v2/insights/gh/$ORG_SLUG/summary' --header 'Circle-Token: $CIRCLE_TOKEN'

it has a key in response all_projects with list of project slugs

NicolaiLolansen commented 1 year ago

This endpoint seems to be limited in the amount of projects it returns

alrodgers commented 1 year ago

Yes, doesn't list all my projects. :(

pinko-fowle commented 1 year ago

We're trying to rotate all our secrets per the recent security incident, and lacking this capability is bringing us down a lot.

nslusher-sf commented 1 year ago

We're trying to rotate all our secrets per the recent security incident, and lacking this capability is bringing us down a lot.

I was looking for this functionality as well and not having it is definitely slowing us down. While there is a tool that was posted to track down secrets it does not provide the ability to list all projects with SSH keys.

NicolaiLolansen commented 1 year ago

We ended up going the other way, using the Github API to list all projects with a token called "CircleCi", then used those slugs to first delete, then add them again with the CircleCI API. Also deleting the deploy key on circleCI does not propagate and delete it on Github, you have to also take care of that. It does however require a personal-token that has access to all those organizations.

You can use the same "trick" to pull env-variables as you now have the project slugs needed to look them up one by one.

alrodgers commented 1 year ago

Update: our SecOps team were able to obtain a list of all our configured projects by contacting CircleCI directly.

Nicolai's approach wouldn't have worked well for us, as we also had some obsolete projects that had secrets configured as env vars but didn't have tokens configured in GitHub any more.