# requirements: curl, jq # By default this script will get 100 projects at a time # If you have more than 100 projects . run this script multiple times USER=user PASSWORD=password SONAR_URL=http://localhost:9000 for pkey in `curl ${SONAR_URL}/api/components/search?qualifiers=TRK | jq -r .components[].key`; do curl -X POST -v -u ${USER}:${PASSWORD} ${SONAR_URL}/api/projects/update_visibility?project=${pkey}\&visibility=private; done