Is there a web api for scan ununsed java method?

i want to do a work,just find the ununed java methods and notify other people using a excel.
can you supply a this web rest api or java coding api?

Hey there.

Sure, for projects analyzed on a SonarQube instance you can tap into the GET api/issues/search Web API and filter for rules=java%3AS1144 in order to get all instances of java:S1144: Unused “private” methods should be removed.

That API call would look something like this:

https://<YOUR_SONARQUBE_URL>/api/issues/search?s=FILE_LINE&rules=java%3AS1144&issueStatuses=CONFIRMED%2COPEN&ps=100&facets=cleanCodeAttributeCategories%2CimpactSoftwareQualities%2Cseverities%2Ctypes%2CimpactSeverities&additionalFields=_all&timeZone=Europe%2FZurich

From there you can do whatever you want with the results, like pipe them into an Excel sheet.

However, it’s probably more useful to use a centralized SonarQube instance where all your developers can look at the results. For example, here’s our own SonarQube instance filtered down to java:S1144.