/api/applications/add_project does NOT check for duplicate projects in the application

SonarQube EE 7.9.0, PostgreSQL 10.9

Steps to reproduce:

curl -X POST -d “application=$APP&project=$PROJECT” http://$URL/api/applications/add_project
curl -X POST -d “application=$APP&project=$PROJECT” http://$URL/api/applications/add_project
curl -v http://$URL/api/applications/show?application=$APP

Expected result:
HTTP 200 + a list of projects

Actual result:
HTTP 400 + {“errors”:[{“msg”:“Duplicate key $PROJECT”}]}

Hi,

The web services we write are intended to be used by the UI, which guides you (prevents you, really) in not selecting the same project twice.

 
Ann

Thanks for the response Ann, my understanding was that this only applies to Internal APIs.

UI is not an option for us, but we can work around this in other ways.

Hi,

Out of curiosity, would you mind explaining why the UI isn’t an option?

 
Thx,
Ann

Sure, it’s mainly because our codebase is split over an unusually large number of projects, new ones get created regularly and we want them to be assigned to the right portfolios/apps automatically by the jenkins pipelines.

Hi,

Thanks for sharing!

As a side note you may be interested in the fact that you can delegate the administration of individual applications without needing to grant global admin.

 
Ann